Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-85702: Catch PermissionError in zoneinfo.load_tzdata()#136117

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vstinner merged 3 commits intopython:mainfromvstinner:zoneinfo_is_dir
Jun 30, 2025

Conversation

@vstinner
Copy link
Member

@vstinnervstinner commentedJun 30, 2025
edited by bedevere-appbot
Loading

@vstinner
Copy link
MemberAuthor

vstinner commentedJun 30, 2025
edited
Loading

On Windows, test_zoneinfo.test_bad_keys() fails without this fix if tzdata is installed.

vstinner@WIN C:\victor\python\main>env\scripts\python -m test test_zoneinfo -m test_bad_keys -v...ERROR: test_bad_keys (test.test_zoneinfo.test_zoneinfo.CTZDataTests.test_bad_keys)  ----------------------------------------------------------------------Traceback (most recent call last):  File "C:\victor\python\main\Lib\test\test_zoneinfo\test_zoneinfo.py", line 231, in test_bad_keys    self.klass(bad_key)    ~~~~~~~~~~^^^^^^^^^  File "C:\victor\python\main\Lib\zoneinfo\_common.py", line 12, in load_tzdata         return resources.files(package_name).joinpath(resource_name).open("rb")           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^  File "C:\victor\python\main\Lib\pathlib\__init__.py", line 777, in open    return io.open(self, mode, buffering, encoding, errors, newline)           ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^PermissionError: [Errno 13] Permission denied: 'C:\\victor\\python\\main\\env\\Lib\\site-packages\\tzdata\\zoneinfo\\Europe'...

test_zoneinfo.test_bad_keys() pass with this fix (if tzdata is installed).

vstinner@WIN C:\victor\python\main>env\scripts\python -m test test_zoneinfo -m test_bad_keys -v...Result: SUCCESS

@vstinner
Copy link
MemberAuthor

cc@StanFromIreland

Copy link
Member

@StanFromIrelandStanFromIreland left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM

Test fail is unrelated, and there is no need to add another test since this is covered by existing ones as you noted. Though I would not mind if there was a comment explaining why this is done. e.g.

# Workaround for Windows, see gh-85702

@vstinner
Copy link
MemberAuthor

Though I would not mind if there was a comment explaining why this is done.

I added a comment.

StanFromIreland reacted with thumbs up emoji

Copy link
Member

@ZeroIntensityZeroIntensity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think there should be a test for this on Windows.

@StanFromIreland
Copy link
Member

@ZeroIntensity

There already was, see Victor's comment:#136117 (comment)

So I assume we have no CI/Buildbots with tzdata installed.

@ZeroIntensity
Copy link
Member

Yeah, I know, intuition is telling me that we don't want tests that incidentally catch a bug. But I didn't realize that there aren't buildbots with tzdata installed, so I guess it's a moot point.

StanFromIreland reacted with thumbs up emoji

…rbwu.rstCo-authored-by: Peter Bierma <zintensitydev@gmail.com>
@vstinner
Copy link
MemberAuthor

I think there should be a test for this on Windows.

There is already test_zoneinfo.test_bad_keys().

Copy link
Member

@ZeroIntensityZeroIntensity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM as well. Looking at the test, it does seem to be exercising exactly what I'd wanted. We should probably try to get tzdata installed on one of the Windows buildbots.

@StanFromIreland
Copy link
Member

I hope I get a definitive reply to my question on the Discord... I can install it on mine but I will probably have to drop it to unstable.

@vstinnervstinner merged commitee47670 intopython:mainJun 30, 2025
44 checks passed
@vstinnervstinner deleted the zoneinfo_is_dir branchJune 30, 2025 14:33
@miss-islington-app
Copy link

Thanks@vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestJun 30, 2025
…onGH-136117)(cherry picked from commitee47670)Co-authored-by: Victor Stinner <vstinner@python.org>Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
@miss-islington-app
Copy link

Sorry,@vstinner, I could not cleanly backport this to3.13 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker ee47670e8b8648b14fd4cb64a9d47d6ed3c5b6b7 3.13

@bedevere-app
Copy link

GH-136128 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelJun 30, 2025
vstinner added a commit that referenced this pull requestJun 30, 2025
…136117) (#136128)gh-85702: Catch PermissionError in zoneinfo.load_tzdata() (GH-136117)(cherry picked from commitee47670)Co-authored-by: Victor Stinner <vstinner@python.org>Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
@vstinnervstinner removed the needs backport to 3.13bugs and security fixes labelJun 30, 2025
@vstinnervstinner added the needs backport to 3.13bugs and security fixes labelJun 30, 2025
@miss-islington-app
Copy link

Thanks@vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestJun 30, 2025
…onGH-136117)(cherry picked from commitee47670)Co-authored-by: Victor Stinner <vstinner@python.org>Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
@bedevere-app
Copy link

GH-136136 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelJun 30, 2025
vstinner added a commit that referenced this pull requestJun 30, 2025
…136117) (#136136)gh-85702: Catch PermissionError in zoneinfo.load_tzdata() (GH-136117)(cherry picked from commitee47670)Co-authored-by: Victor Stinner <vstinner@python.org>Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
AndPuQing pushed a commit to AndPuQing/cpython that referenced this pull requestJul 11, 2025
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull requestJul 12, 2025
picnixz pushed a commit to picnixz/cpython that referenced this pull requestJul 13, 2025
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull requestAug 4, 2025
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull requestAug 19, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ZeroIntensityZeroIntensityZeroIntensity approved these changes

@StanFromIrelandStanFromIrelandStanFromIreland approved these changes

Assignees

@vstinnervstinner

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@vstinner@StanFromIreland@ZeroIntensity

[8]ページ先頭

©2009-2025 Movatter.jp