-
-
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:
When using _datetimemodule.c
implementation:
>>> from datetime import datetime
... from zoneinfo import ZoneInfo
... datetime(2025, 10, 26, 2, 0, tzinfo=ZoneInfo("Europe/Paris"))
...
datetime.datetime(2025, 10, 26, 2, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/Paris'))
However, with _pydatetime.py
implementation:
>>> from _pydatetime import datetime
... from zoneinfo import ZoneInfo
... datetime(2025, 10, 26, 2, 0, tzinfo=ZoneInfo("Europe/Paris"))
...
Traceback (most recent call last):
File "<python-input-8>", line 3, in <module>
datetime(2025, 10, 26, 2, 0, tzinfo=ZoneInfo("Europe/Paris"))
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.15/_pydatetime.py", line 1807, in __new__
_check_tzinfo_arg(tzinfo)
~~~~~~~~~~~~~~~~~^^^^^^^^
File "/usr/local/lib/python3.15/_pydatetime.py", line 610, in _check_tzinfo_arg
raise TypeError(
...<2 lines>...
)
TypeError: tzinfo argument must be None or of a tzinfo subclass, not 'ZoneInfo'
CPython versions tested on:
CPython main branch, 3.14, 3.13
Operating systems tested on:
No response
Linked PRs
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