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

Co-authored-by: Stan Ulbrych <stan@python.org>
This commit is contained in:
Weilin Du 2026-06-16 00:11:10 +08:00 committed by GitHub
parent 46107ad9da
commit 585e14c7d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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):