-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
fix overflows in Timestamp.tz_localize near boundaries #19626
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #19626 +/- ##
==========================================
- Coverage 91.62% 91.61% -0.01%
==========================================
Files 150 150
Lines 48798 48807 +9
==========================================
+ Hits 44709 44716 +7
- Misses 4089 4091 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a whatsnew note, small changes. ping on green.
pandas/_libs/tslibs/conversion.pyx
Outdated
@@ -490,12 +493,37 @@ cdef _TSObject convert_str_to_tsobject(object ts, object tz, object unit, | |||
return convert_to_tsobject(ts, tz, unit, dayfirst, yearfirst) | |||
|
|||
|
|||
cdef inline _check_silent_overflows(_TSObject obj): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
de-privatize. by definition not public if its not in the .pxd
pandas/_libs/tslibs/conversion.pyx
Outdated
# ---------------------------------------------------------------------- | ||
# Localization | ||
|
||
cdef inline void _localize_tso(_TSObject obj, object tz): | ||
cdef inline void _localize_tso(_TSObject obj, tzinfo tz): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you de-privatize
@@ -15,12 +15,29 @@ | |||
import pandas.util._test_decorators as td | |||
|
|||
from pandas import Timestamp, NaT | |||
from pandas._libs.tslib import OutOfBoundsDatetime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from pandas.errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more minor comment
pandas/_libs/tslibs/conversion.pyx
Outdated
if obj.value != NPY_NAT: | ||
# check_silent_overflows needs to run after localize_tso | ||
check_dts_bounds(&obj.dts) | ||
check_silent_overflows(obj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to check_overlows
pandas/_libs/tslibs/conversion.pyx
Outdated
@@ -490,12 +493,37 @@ cdef _TSObject convert_str_to_tsobject(object ts, object tz, object unit, | |||
return convert_to_tsobject(ts, tz, unit, dayfirst, yearfirst) | |||
|
|||
|
|||
cdef inline check_silent_overflows(_TSObject obj): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename, add doc-string (just convert your comment)
pandas/_libs/tslibs/conversion.pyx
Outdated
|
||
Returns | ||
------- | ||
(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None
lgtm. ping ongreen. |
Ping |
thanks |
some warnings as a result of this change
|
when you have a chance can you look at the warnings above: #19626 (comment) |
Flesh out docstring for localize_tsobject, add slightly stronger typing.
Closes #12677