From 986417358bcec78f93bfaf9fdc9d64e8cf7f7a71 Mon Sep 17 00:00:00 2001 From: hhaensel Date: Tue, 21 Jan 2025 17:02:13 +0100 Subject: [PATCH] fix compat with julia < 1.8 --- src/Convert/Convert.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Convert/Convert.jl b/src/Convert/Convert.jl index 99ef7c83..e3145d58 100644 --- a/src/Convert/Convert.jl +++ b/src/Convert/Convert.jl @@ -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")