https://github.com/python/cpython/commit/585e14c7d3fbe773ff54b4038567ca1159fb295a
commit: 585e14c7d3fbe773ff54b4038567ca1159fb295a
branch: main
author: Weilin Du <[email protected]>
committer: StanFromIreland <[email protected]>
date: 2026-06-15T17:11:10+01:00
summary:

gh-140145: Use repr of the key in `zoneinfo` "No time zone found" error 
(#140433)

Co-authored-by: Stan Ulbrych <[email protected]>

files:
M Lib/zoneinfo/_common.py

diff --git a/Lib/zoneinfo/_common.py b/Lib/zoneinfo/_common.py
index 98668c15d8bf94b..caa3a5b583bab32 100644
--- a/Lib/zoneinfo/_common.py
+++ b/Lib/zoneinfo/_common.py
@@ -26,7 +26,7 @@ def load_tzdata(key):
         # UnicodeEncodeError: If package_name or resource_name are not UTF-8,
         #   such as keys containing a surrogate character.
         # IsADirectoryError: If package_name without a resource_name specified.
-        raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
+        raise ZoneInfoNotFoundError(f"No time zone found with key {key!r}")
 
 
 def load_data(fobj):

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to