-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-96463: fix load_tzdata
raising OSError
, not `ZoneInfoNotFound…
#99602
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
base: main
Are you sure you want to change the base?
Conversation
Looks like we don't have CC @pganssle |
The ARM Raspbian bot has |
Are we talking about the system tzdata package, or the PyPI package? |
I am talking about these lines: try:
importlib.metadata.metadata("tzdata")
HAS_TZDATA_PKG = True
except importlib.metadata.PackageNotFoundError:
HAS_TZDATA_PKG = False
if HAS_TZDATA_PKG:
raise ValueError('Fail the test') |
That'd be the PyPI package, but that is not required if you have system provided tzdata. I would expect most, if not all, the build bots to have system provided tzdata, so the behavior we are seeing makes sense. cpython/Lib/zoneinfo/_zoneinfo.py Lines 61 to 75 in b430399
We have two ways of loading tzdata. The first is via tzpath (searches in cpython/Lib/zoneinfo/_tzpath.py Lines 65 to 73 in b430399
cpython/Lib/zoneinfo/_tzpath.py Lines 5 to 28 in b430399
The second one, is via a cpython/Lib/zoneinfo/_common.py Lines 4 to 24 in b430399
The current tests override tzpath and let cpython/Lib/test/test_zoneinfo/_support.py Lines 68 to 100 in b430399
cpython/Lib/test/test_zoneinfo/test_zoneinfo.py Lines 76 to 87 in b430399
Adding the invalid key to The equivalent code for the tzdata codepath is cpython/Lib/zoneinfo/_tzpath.py Lines 65 to 73 in b430399
Like I mentioned above, I think we need a specific test for @sobolevn does that make sense to you? Is there anything you think I am missing? I hope this makes things clearer for you 😅 |
I expect this to fail at first. This will make sure that we have
tzdata
installed at least somewhere in out test suite.