X Tutup
The Wayback Machine - https://web.archive.org/web/20260312110536/https://github.com/python/cpython/issues/103648
Skip to content

Invalid arument error for datetime.timestamp() method in windows #103648

@subindevs

Description

@subindevs

Bug report

In Windows 10 for a datetime.datetime class if the year value is greater than 3001, then the timestamp() method returns invalid argument error.

File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument

Reproducible example

>>> from datetime import datetime
>>> max_time = datetime(year=9000,month=1,day=1,hour=0,minute=0,second=0)
>>> max_time.timestamp()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument
>>>

Your environment

  • CPython versions tested on: Python 3.11.3
  • Operating system and architecture: Windows 10, 64bit
    Python 3.11.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)] on win32

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

      X Tutup