pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/pull/136117/files

s" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-2d31826944fd3be8.css" /> gh-85702: Catch PermissionError in zoneinfo.load_tzdata() by vstinner · Pull Request #136117 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Lib/zoneinfo/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ def load_tzdata(key):
resource_name = components[-1]

try:
return resources.files(package_name).joinpath(resource_name).open("rb")
path = resources.files(package_name).joinpath(resource_name)
# gh-85702: Prevent PermissionError on Windows
if path.is_dir():
raise IsADirectoryError
return path.open("rb")
except (ImportError, FileNotFoundError, UnicodeEncodeError, IsADirectoryError):
# There are three types of exception that can be raised that all amount
# There are four types of exception that can be raised that all amount
# to "we cannot find this key":
#
# ImportError: If package_name doesn't exist (e.g. if tzdata is not
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
If ``zoneinfo._common.load_tzdata`` is given a package without a resource a
:exc:`zoneinfo.ZoneInfoNotFoundError` is raised rather than a :exc:`PermissionError`.
Patch by Victor Stinner.
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy