-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Open
Labels
OS-windowsstdlibPython modules in the Lib dirPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
dt.datetime.fromtimestamp(t).astimezone()
fails for 0
<=t
<86400
in Windows for at least python 3.9, 3.10, 3.11.
Works fine in Linux, Mac.
>> import datetime as dt
>> dt.datetime.fromtimestamp(0)
datetime.datetime(1970, 1, 1, 1, 0)
>> dt.datetime.fromtimestamp(86400)
datetime.datetime(1970, 1, 2, 1, 0)
>> dt.datetime.fromtimestamp(0).astimezone()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument
>> dt.datetime.fromtimestamp(86399).astimezone()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument
>> dt.datetime.fromtimestamp(86400).astimezone()
datetime.datetime(1970, 1, 2, 1, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=3600), 'W. Europe Standard Time'))
Your environment
- CPython versions tested on: 3.9, 3.10, 3.11
- Operating system and architecture: Windows
Additional information
This looks very very related to this issue: #73283 but now it seems to happen for astimezone
.
Linked PRs
Yuvix25
Metadata
Metadata
Assignees
Labels
OS-windowsstdlibPython 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