Skip to content

datetime does not support timestamps after 2038 on 32-bit #101069

@bmwiedemann

Description

@bmwiedemann

Bug report

cpython on 32-bit platforms cannot handle dates beyond 2038-01-19

python3.10 -c 'import datetime; datetime.datetime.fromtimestamp(3000000000)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
OverflowError: timestamp out of range for platform time_t

Your environment

  • CPython versions tested on: 3.8, 3.9, 3.10
  • Operating system and architecture: openSUSE-Tumbleweed 20230110 i586

This comes from
https://github.com/python/cpython/blob/8e9d08b0/Modules/_datetimemodule.c#L4982
https://github.com/python/cpython/blob/8e9d08b0/Python/pytime.c#L173

These could use __time64_t if available or we compile everything with __TIMESIZE=64

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions