Skip to content

Commit

Permalink
fix compat with julia < 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaensel committed Jan 21, 2025
1 parent 34f35ce commit 9864173
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Convert/Convert.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ using Dates: Year, Month, Day, Hour, Minute, Week, Period, CompoundPeriod, canon

import ..Core: pyconvert

# patch conversion to Period types for julia <= 1.7
@static if VERSION < v"1.8.0-"
Base.convert(::Type{T}, x::CompoundPeriod) where T<:Period =
isconcretetype(T) ? sum(T, x.periods; init = zero(T)) : throw(MethodError(convert,(T,x)))
end

include("pyconvert.jl")
include("rules.jl")
include("ctypes.jl")
Expand Down

0 comments on commit 9864173

Please sign in to comment.