JuliaTime / TimeZones.jl

IANA time zone database access for the Julia programming language
Other
86 stars 51 forks source link

Address `argerror` deprecation #417

Closed omus closed 1 year ago

omus commented 1 year ago

Fixes these deprecations introduced in https://github.com/JuliaLang/julia/pull/46031:

 ┌ Warning: `argerror()` is deprecated, use `nothing` instead.
│   caller = validargs(#unused#::Type{ZonedDateTime}, y::Int64, m::Int64, d::Int64, h::Int64, mi::Int64, s::Int64, ms::Int64, tz::SubString{String}) at zoneddatetime.jl:192
└ @ TimeZones ~/work/TimeZones.jl/TimeZones.jl/src/types/zoneddatetime.jl:192
┌ Warning: `argerror(msg::String)` is deprecated, use `ArgumentError(msg)` instead.
│   caller = validargs(#unused#::Type{ZonedDateTime}, y::Int64, m::Int64, d::Int64, h::Int64, mi::Int64, s::Int64, ms::Int64, tz::String) at zoneddatetime.jl:191
└ @ TimeZones ~/work/TimeZones.jl/TimeZones.jl/src/types/zoneddatetime.jl:191

As I was interested to see if the behaviour of argerror had differed in the past I found that this function used Nullable way back in Julia before 0.7.0-DEV.3017. So as TimeZones requires Julia 1.6+ now we're safe to follow the deprecation.

codecov-commenter commented 1 year ago

Codecov Report

Merging #417 (77d9877) into master (df83b2b) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #417   +/-   ##
=======================================
  Coverage   95.45%   95.45%           
=======================================
  Files          36       36           
  Lines        1760     1760           
=======================================
  Hits         1680     1680           
  Misses         80       80           
Impacted Files Coverage Δ
src/types/zoneddatetime.jl 96.15% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

omus commented 1 year ago

Julia nightly seems to fail sometimes with:

Testing Running tests...
[ Info: Installing 2016j tzdata region data

[1910] signal (11.1): Segmentation fault
in expression starting at /home/runner/work/TimeZones.jl/TimeZones.jl/test/thread-safety.jl:1
ijl_get_nth_field at /cache/build/default-amdci5-2/julialang/julia-master/src/datatype.c:1502
ijl_get_nth_field_checked at /cache/build/default-amdci5-2/julialang/julia-master/src/datatype.c:1548
#sprint#486 at ./strings/io.jl:114
sprint at ./strings/io.jl:107 [inlined]
#repr#489 at ./strings/io.jl:282 [inlined]
repr at ./strings/io.jl:282 [inlined]
show at /home/runner/work/TimeZones.jl/TimeZones.jl/src/class.jl:55
unknown function (ip: 0xdac3e223)
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2505 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2706
#sprint#486 at ./strings/io.jl:114
sprint at ./strings/io.jl:107 [inlined]
#repr#489 at ./strings/io.jl:282 [inlined]
repr at ./strings/io.jl:282
unknown function (ip: 0xdac3d5a0)
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2505 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2706
TimeZone at /home/runner/work/TimeZones.jl/TimeZones.jl/src/types/timezone.jl:89
TimeZone at /home/runner/work/TimeZones.jl/TimeZones.jl/src/types/timezone.jl:70
create_zdt at /home/runner/work/TimeZones.jl/TimeZones.jl/test/thread-safety.jl:8
#182 at /home/runner/work/TimeZones.jl/TimeZones.jl/test/thread-safety.jl:13 [inlined]
#182 at ./none:0
iterate at ./generator.jl:47 [inlined]
iterate at ./iterators.jl:1192 [inlined]
iterate at ./iterators.jl:1192 [inlined]
iterate at ./iterators.jl:1192 [inlined]
grow_to! at ./array.jl:886
grow_to! at ./array.jl:884
unknown function (ip: 0xd10f8196)
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2505 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2706
grow_to! at ./array.jl:859
_collect at ./array.jl:759 [inlined]
collect at ./array.jl:707 [inlined]
cycle_zdts at /home/runner/work/TimeZones.jl/TimeZones.jl/test/thread-safety.jl:11 [inlined]
macro expansion at /home/runner/work/TimeZones.jl/TimeZones.jl/test/thread-safety.jl:30 [inlined]
#186 at ./threadingconstructs.jl:340
unknown function (ip: 0xd10f17ce)
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2524 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2706
jl_apply at /cache/build/default-amdci5-2/julialang/julia-master/src/julia.h:1872 [inlined]
start_task at /cache/build/default-amdci5-2/julialang/julia-master/src/task.c:1091
Allocations: 60617058 (Pool: 60590352; Big: 26706); GC: 59
ERROR: LoadError: Package TimeZones errored during testing (received signal: 11)
Stacktrace:
 [1] pkgerror(msg::String)
   @ Pkg.Types /opt/hostedtoolcache/julia/nightly/x86/share/julia/stdlib/v1.10/Pkg/src/Types.jl:68
 [2] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, julia_args::Cmd, test_args::Cmd, test_fn::Nothing, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool)
   @ Pkg.Operations /opt/hostedtoolcache/julia/nightly/x86/share/julia/stdlib/v1.10/Pkg/src/Operations.jl:1878
 [3] test
   @ /opt/hostedtoolcache/julia/nightly/x86/share/julia/stdlib/v1.10/Pkg/src/Operations.jl:1755 [inlined]
 [4] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, test_fn::Nothing, julia_args::Vector{String}, test_args::Cmd, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool, kwargs::Base.Pairs{Symbol, IOContext{Base.PipeEndpoint}, Tuple{Symbol}, NamedTuple{(:io,), Tuple{IOContext{Base.PipeEndpoint}}}})
   @ Pkg.API /opt/hostedtoolcache/julia/nightly/x86/share/julia/stdlib/v1.10/Pkg/src/API.jl:435
 [5] test(pkgs::Vector{Pkg.Types.PackageSpec}; io::IOContext{Base.PipeEndpoint}, kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:julia_args, :coverage, :force_latest_compatible_version), Tuple{Vector{String}, Bool, Bool}}})
   @ Pkg.API /opt/hostedtoolcache/julia/nightly/x86/share/julia/stdlib/v1.10/Pkg/src/API.jl:156
 [6] test(; name::Nothing, uuid::Nothing, version::Nothing, url::Nothing, rev::Nothing, path::Nothing, mode::Pkg.Types.PackageMode, subdir::Nothing, kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:julia_args, :coverage, :force_latest_compatible_version), Tuple{Vector{String}, Bool, Bool}}})
   @ Pkg.API /opt/hostedtoolcache/julia/nightly/x86/share/julia/stdlib/v1.10/Pkg/src/API.jl:171
 [7] top-level scope
   @ ~/work/_actions/julia-actions/julia-runtest/latest/test_harness.jl:15
 [8] include(fname::String)
   @ Base.MainInclude ./client.jl:478
 [9] top-level scope
   @ none:1
in expression starting at /home/runner/work/_actions/julia-actions/julia-runtest/latest/test_harness.jl:7
Error: Process completed with exit code 1.
omus commented 1 year ago

As the failures are limited to nightly I'm going to proceed