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

DateTime's parsing causes Domain Error #22100

Closed
portig opened this issue May 27, 2017 · 3 comments
Closed

DateTime's parsing causes Domain Error #22100

portig opened this issue May 27, 2017 · 3 comments
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior dates Dates, times, and the Dates stdlib module regression Regression in behavior compared to a previous version
Milestone

Comments

@portig
Copy link

portig commented May 27, 2017

dt = DateTime("2017-Mar-17 00:00:00.0000", "y-u-d H:M:S.s")

This statement causes the Domain Error in both Julia 0.6 rc1 and rc2 with the following traceback:

ERROR: DomainError:
Cannot raise an integer x to a negative power -n. 
Make x a float by adding a zero decimal (e.g. 2.0^-n instead of 2^-n), or write 1/x^n, float(x)^-n, or (x//1)^-n.
Stacktrace:
 [1] power_by_squaring(::Int64, ::Int64) at ./intfuncs.jl:170
 [2] tryparsenext at ./dates/io.jl:114 [inlined]
 [3] tryparsenext at ./dates/io.jl:42 [inlined]
 [4] macro expansion at ./dates/parse.jl:65 [inlined]
 [5] tryparsenext_core(::String, ::Int64, ::Int64, ::DateFormat{Symbol("y-u-d H:M:S.s"),Tuple{Base.Dates.DatePart{'y'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'u'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'d'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'H'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'M'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'S'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'s'}}}, ::Bool) at ./dates/parse.jl:39
 [6] macro expansion at ./dates/parse.jl:153 [inlined]
 [7] tryparsenext_internal(::Type{DateTime}, ::String, ::Int64, ::Int64, ::DateFormat{Symbol("y-u-d H:M:S.s"),Tuple{Base.Dates.DatePart{'y'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'u'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'d'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'H'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'M'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'S'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'s'}}}, ::Bool) at ./dates/parse.jl:129
 [8] parse(::Type{DateTime}, ::String, ::DateFormat{Symbol("y-u-d H:M:S.s"),Tuple{Base.Dates.DatePart{'y'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'u'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'d'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'H'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'M'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'S'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'s'}}}) at ./dates/parse.jl:270
 [9] DateTime(::String, ::String) at ./dates/io.jl:403

This was working fine in Julia 0.5

@tkelman tkelman added the dates Dates, times, and the Dates stdlib module label May 27, 2017
@StefanKarpinski StefanKarpinski added the bug Indicates an unexpected problem or unintended behavior label May 30, 2017
@StefanKarpinski StefanKarpinski added this to the 0.6.0 milestone May 30, 2017
@quinnj
Copy link
Member

quinnj commented May 30, 2017

@omus @shashi

@quinnj quinnj assigned shashi and omus and unassigned quinnj and stevengj May 30, 2017
@tkelman tkelman modified the milestones: 0.5.x, 0.6.0, 0.6.x May 31, 2017
@JeffBezanson JeffBezanson added the regression Regression in behavior compared to a previous version label May 31, 2017
@stevengj
Copy link
Member

Presumably this line should be:

ms = Nullable{Int64}(round(Int64, get(ms) * exp10(3 - (ii - i))))

@omus
Copy link
Member

omus commented May 31, 2017

I'll try to deal with this tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior dates Dates, times, and the Dates stdlib module regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

8 participants