-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Incorrect tzinfo check in tslibs.parsing #22234
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
Comments
The same check (bug?) exists in dateutil: Also it looks like However if there are no conditions where we ever hit this branch, I would vote nix it. |
|
Ah good catch. Looks like a copy-paste bug then. But I think this branch will never be hit: So pandas/pandas/_libs/tslibs/parsing.pyx Lines 159 to 160 in 737b329
And a default kwarg pandas/pandas/_libs/tslibs/parsing.pyx Line 334 in 737b329
|
I would just remove the logic and see if any tests break. That would help to confirm 🙂 |
We briefly discussed at the sprint the idea of correctly parsing some timezone strings where the correct answer is unambiguous (e.g. "CEST" should always be "Central European Summer Time"). If we go down that road, it will be by passing i.e. we shouldn't nix all of that code, and as long as we have some of it, it's worth keeping it parallel to the dateutil version (since it is basically copy/pasted) |
I see. In that case, makes sense to keep it for now. To pay it forward though we can at least fix the |
https://github.com/pandas-dev/pandas/blob/master/pandas/_libs/tslibs/parsing.pyx#L339
If this were ever hit it would raise an error because
datetime.tzinfo
refers to the tzinfo attached to a datetime object, not the tzinfo class defined in the datetime module.There's basically no path by which this would be reached because we never pass a
tzdata
to this function. So two things should happen: fix this to check for the correct object, and either remove unreachable code or make it reachable.The text was updated successfully, but these errors were encountered: