-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: catch stricter in json #28351
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
CLN: catch stricter in json #28351
Conversation
Not that I know of. Probably OK to consolidate with exception above |
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.
lgtm
@@ -972,10 +972,8 @@ def _try_convert_to_date(self, data): | |||
for date_unit in date_units: | |||
try: | |||
new_data = to_datetime(new_data, errors="raise", unit=date_unit) | |||
except ValueError: | |||
except (ValueError, OverflowError): |
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.
Actually should we be catching an OutOfBoundsDatetime
exception here? Not sure if test coverage is hitting that but I think easy enough to trigger (just try a date like "9999-01-01")
Out of curiosity what causes the OverflowError?
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.
I think it is cast_to_unit being called inside array_to_datetime, but would have to check.
OutOfBoundsDatetime
subclasses ValueError
so that is already caught.
lgtm. |
Thanks @jbrockmendel |
@WillAyd think there is a compelling reason to keep this as
break
instead of lumping it into thecontinue
clause above?(obviously the TODO comment will be removed/resolved before merge)