]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-80620: Support negative timestamps on windows in `time.gmtime`, `time.localtime... 143862/head
authorPeter Gessler <gesslerpd@users.noreply.github.com>
Thu, 15 Jan 2026 09:51:11 +0000 (03:51 -0600)
committerGitHub <noreply@github.com>
Thu, 15 Jan 2026 09:51:11 +0000 (10:51 +0100)
commitf5685a266b252455e03ef8e6055eaf4007ec749d
tree5de2b425e618b69cb0c98558248fe5eaa8085752
parent565685f6e88fd333326baff6469f53cfff28e01e
gh-80620: Support negative timestamps on windows in `time.gmtime`, `time.localtime`, and `datetime` module (#143463)

Previously, negative timestamps (representing dates before 1970-01-01) were
not supported on Windows due to platform limitations. The changes introduce a
fallback implementation using the Windows FILETIME API, allowing negative
timestamps to be correctly handled in both UTC and local time conversions.
Additionally, related test code is updated to remove Windows-specific skips
and error handling, ensuring consistent behavior across platforms.

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/test/datetimetester.py
Lib/test/test_time.py
Misc/NEWS.d/next/Windows/2026-01-05-21-36-58.gh-issue-80620.p1bD58.rst [new file with mode: 0644]
Modules/_datetimemodule.c
Python/pytime.c