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

zoneinfo.available_timezones() emitsEncodingWarning on python 3.11+ ifftzdata is installed and-X warn_default_encoding is used #137841

Closed
Labels
stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
@Liam-DeVoe

Description

@Liam-DeVoe

Bug report

Bug description:

On a fresh install:

~/Desktopλpython3.11-Xwarn_default_encodingPython3.11.8 (main,Feb62024,21:21:21) [Clang15.0.0 (clang-1500.1.0.2.5)]ondarwinType"help","copyright","credits"or"license"formoreinformation.>>>importzoneinfo;zoneinfo.available_timezones()...

afterpython3.11 -m pip install tzdata:

~/Desktopλpython3.11-Xwarn_default_encodingPython3.11.8 (main,Feb62024,21:21:21) [Clang15.0.0 (clang-1500.1.0.2.5)]ondarwinType"help","copyright","credits"or"license"formoreinformation.>>>importzoneinfo;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'argumentnotspecified

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:withresources.files("tzdata").joinpath("zones").open("r")asf:forzoneinf:zone=zone.strip()ifzone:valid_zones.add(zone)except (ImportError,FileNotFoundError):pass

CPython versions tested on:

3.11

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp