-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
Open
Labels
stdlibPython modules in the Lib dirPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
On a fresh install:
~/Desktop λ python3.11 -X warn_default_encoding
Python 3.11.8 (main, Feb 6 2024, 21:21:21) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import zoneinfo; zoneinfo.available_timezones()
...
after python3.11 -m pip install tzdata
:
~/Desktop λ python3.11 -X warn_default_encoding
Python 3.11.8 (main, Feb 6 2024, 21:21:21) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import zoneinfo; zoneinfo.available_timezones()
/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/zoneinfo/_tzpath.py:121: EncodingWarning: 'encoding' argument not specified
I tested python 3.10 (no), 3.11 (yes), 3.12 (yes), and 3.13 (yes).
This occurs because .open("r")
does not specify an encoding here:
try:
with resources.files("tzdata").joinpath("zones").open("r") as f:
for zone in f:
zone = zone.strip()
if zone:
valid_zones.add(zone)
except (ImportError, FileNotFoundError):
pass
CPython versions tested on:
3.11
Operating systems tested on:
macOS
Innoviox
Metadata
Metadata
Assignees
Labels
stdlibPython modules in the Lib dirPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
No status