➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients belopolsky, p-ganssle
Date 2020-02-19.00:56:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582073760.64.0.932670669115.issue39680@roundup.psfhosted.org>
In-reply-to
Content
Let g be a an invalid time in New York spring-forward gap:

>>> g = datetime(2020, 3, 8, 2, 30)

According to PEP 495, conversion of such instance to UTC should return a value that corresponds to a valid local time greater than g, but

>>> print(g.astimezone(timezone.utc).astimezone())
2020-03-08 01:30:00-05:00

Also, conversion of the same instance with fold=1 to UTC and back should produce a lesser time, but

>>> print(g.replace(fold=1).astimezone(timezone.utc).astimezone())
2020-03-08 03:30:00-04:00

Note that conversion to and from timestamp works correctly:

>>> print(datetime.fromtimestamp(g.timestamp()))
2020-03-08 03:30:00
>>> print(datetime.fromtimestamp(g.replace(fold=1).timestamp()))
2020-03-08 01:30:00
History
Date User Action Args
2020-02-19 00:56:00belopolskysetrecipients: + belopolsky, p-ganssle
2020-02-19 00:56:00belopolskysetmessageid: <1582073760.64.0.932670669115.issue39680@roundup.psfhosted.org>
2020-02-19 00:56:00belopolskylinkissue39680 messages
2020-02-19 00:56:00belopolskycreate