You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ZoneInfo gives a surprising exception for '' #114713
>>> 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 case
it 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 well
Activity
gh-114713: Handle case of an empty string passed to `zoneinfo.ZoneInf…
pythongh-114713: Handle case of an empty string passed to `zoneinfo.Z…
[3.13] gh-114713: Handle case of an empty string passed to `zoneinfo.…
Revert "pythongh-114713: Handle case of an empty string passed to `zo…
gh-114713: Revert gh-114731 (#133330)
pythongh-114713: Revert pythongh-114731 (pythonGH-133330)
[3.13] gh-114713: Revert gh-114731 (GH-133330) (#133331)
pythongh-114713: Revert pythongh-114731 (python#133330)