-
-
Notifications
You must be signed in to change notification settings - Fork 32k
ZoneInfo gives a surprising exception for ''
#114713
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
Eclips4
added a commit
that referenced
this issue
Apr 15, 2025
…o` (#114731) Co-authored-by: Stan Ulbrych <[email protected]> Co-authored-by: Kirill Podoprigora <[email protected]>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Apr 15, 2025
…oneInfo` (pythonGH-114731) (cherry picked from commit 884df11) Co-authored-by: Bogdan Romanyuk <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]> Co-authored-by: Kirill Podoprigora <[email protected]>
Eclips4
added a commit
that referenced
this issue
Apr 15, 2025
…ZoneInfo` (GH-114731) (#132563) gh-114713: Handle case of an empty string passed to `zoneinfo.ZoneInfo` (GH-114731) (cherry picked from commit 884df11) Co-authored-by: Bogdan Romanyuk <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]> Co-authored-by: Kirill Podoprigora <[email protected]>
Eclips4
added a commit
to Eclips4/cpython
that referenced
this issue
May 3, 2025
…neinfo.ZoneInfo` (python#114731)" This reverts commit 884df11.
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
May 3, 2025
Revert "pythongh-114713: Handle case of an empty string passed to `zoneinfo.ZoneInfo` (pythonGH-114731)" This reverts commit 884df11. (cherry picked from commit fe44fc4) Co-authored-by: Kirill Podoprigora <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
results in the following exception:
>>> zoneinfo.ZoneInfo('') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/asottile/.pyenv/versions/3.11.6/lib/python3.11/zoneinfo/_tzpath.py", line 67, in find_tzfile _validate_tzfile_path(key) File "/Users/asottile/.pyenv/versions/3.11.6/lib/python3.11/zoneinfo/_tzpath.py", line 91, in _validate_tzfile_path raise ValueError( ValueError: ZoneInfo keys must be normalized relative paths, got:
I expect
zoneinfo.ZoneInfoNotFound
instead, or some other error that's more specific about this caseit seems this stems from the code internally using the length of the
normpath
'd result of this string and:>>> normpath('') '.'
a small improvement would be to use
!r
in the error message as wellCPython versions tested on:
3.11, CPython main branch
Operating systems tested on:
macOS
Linked PRs
zoneinfo.ZoneInfo
(GH-114731) #132563zoneinfo.ZoneInfo
#132582The text was updated successfully, but these errors were encountered: