datetime.astimezone() returns DST name for negative timestamp on Windows
Open
Nobody has claimed this yet.
interpreter-core
OS-windows
type-bug
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Bug report
Bug description:
PS C:\Users\yukih\Downloads> .\python-3.15.0a8-embed-amd64\python.exe
WARN: Could not find the platform standard library directory! The Python 'home' directory was set to 'C:\\Users\\yukih\\Downloads\\python-3.15.0a8-embed-amd64', is this correct?
Python 3.15.0a8 (tags/v3.15.0a8:55ea59e, Apr 7 2026, 14:21:25) [MSC v.1950 64 bit (AMD64)] on win32
>>> from datetime import datetime
>>>
>>> datetime.fromtimestamp(-1).astimezone()
datetime.datetime(1970, 1, 1, 8, 59, 59, tzinfo=datetime.timezone(datetime.timedelta(seconds=32400), 'Tokyo Daylight Time'))
>>>
>>> datetime.fromtimestamp(0).astimezone()
datetime.datetime(1970, 1, 1, 9, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=32400), 'Tokyo Standard Time'))
I expected "Tokyo Standard Time".
CPython versions tested on:
3.15
Operating systems tested on:
Windows
Linked PRs
- gh-148673
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the negative and zero timestamp cases with datetime.fromtimestamp(...).astimezone() on Windows, then inspect the datetime.astimezone entry point and linked PR gh-148673. Done means the negative timestamp reports the expected "Tokyo Standard Time" name without regressing the zero-timestamp behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 20/100