Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse(Time, str) raises an ArgumentException in Julia 1.6.6 when it should raise InexactError #45202

Open
Wynand opened this issue May 5, 2022 · 1 comment

Comments

@Wynand
Copy link

Wynand commented May 5, 2022

This seems to be a result of #44004 where tryparse was updated to return nothing instead of an InexactError


Julia 1.6.5 and 1.7.2 behaviour:

julia> parse(Time, "13:13:13.13142")
ERROR: InexactError: convert(Dates.Decimal3, 13142)
Stacktrace:
 [1] tryparsenext
   @ /usr/local/julia/share/julia/stdlib/v1.7/Dates/src/io.jl:153 [inlined]
 [2] tryparsenext
   @ /usr/local/julia/share/julia/stdlib/v1.7/Dates/src/io.jl:41 [inlined]
 [3] macro expansion
   @ /usr/local/julia/share/julia/stdlib/v1.7/Dates/src/parse.jl:64 [inlined]
 [4] tryparsenext_core(str::String, pos::Int64, len::Int64, df::DateFormat{Symbol("HH:MM:SS.s"), Tuple{Dates.DatePart{'H'}, Dates.Delim{Char, 1}, Dates.DatePart{'M'}, Dates.Delim{Char, 1}, Dates.DatePart{'S'}, Dates.Delim{Char, 1}, Dates.DatePart{'s'}}}, raise::Bool)
   @ Dates /usr/local/julia/share/julia/stdlib/v1.7/Dates/src/parse.jl:38
 [5] macro expansion
   @ /usr/local/julia/share/julia/stdlib/v1.7/Dates/src/parse.jl:150 [inlined]
 [6] tryparsenext_internal
   @ /usr/local/julia/share/julia/stdlib/v1.7/Dates/src/parse.jl:125 [inlined]
 [7] parse
   @ /usr/local/julia/share/julia/stdlib/v1.7/Dates/src/parse.jl:282 [inlined]
 [8] parse(::Type{Time}, str::String)
   @ Dates /usr/local/julia/share/julia/stdlib/v1.7/Dates/src/parse.jl:281
 [9] top-level scope
   @ REPL[3]:1

julia>

Julia 1.6.6 (and probably 1.7.3) behaviour:

julia> parse(Time, "13:13:13.13142")
ERROR: ArgumentError: Unable to parse date time. Expected directive DatePart(s) at char 10
Stacktrace:
 [1] macro expansion
   @ /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Dates/src/parse.jl:104 [inlined]
 [2] tryparsenext_core(str::String, pos::Int64, len::Int64, df::DateFormat{Symbol("HH:MM:SS.s"), Tuple{Dates.DatePart{'H'}, Dates.Delim{Char, 1}, Dates.DatePart{'M'}, Dates.Delim{Char, 1}, Dates.DatePart{'S'}, Dates.Delim{Char, 1}, Dates.DatePart{'s'}}}, raise::Bool)
   @ Dates /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Dates/src/parse.jl:38
 [3] macro expansion
   @ /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Dates/src/parse.jl:150 [inlined]
 [4] tryparsenext_internal
   @ /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Dates/src/parse.jl:125 [inlined]
 [5] parse
   @ /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Dates/src/parse.jl:282 [inlined]
 [6] parse(::Type{Time}, str::String)
   @ Dates /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Dates/src/parse.jl:281
 [7] top-level scope
   @ REPL[3]:1

julia>

related comment: #44004 (comment)
related MR where this issue was noticed: JuliaDatabases/LibPQ.jl#248

@Wynand
Copy link
Author

Wynand commented May 5, 2022

I think it still makes sense for tryparse not to raise InexactError, but also that parse should still raise it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant