[issue24773] Implement PEP 495 (Local Time Disambiguation)

Martin Panter report at bugs.python.org
Mon Jul 25 00:58:20 EDT 2016


Martin Panter added the comment:

Without blocking the C implementation _datetime, I get both extremes causing OverflowError:

>>> import datetime, time, os
>>> os.environ["TZ"] = "EST+05EDT,M3.2.0,M11.1.0"
>>> time.tzset()
>>> t = datetime.datetime(2,1,1)
>>> s = t.timestamp()
>>> s
-122233584944.0
>>> datetime.datetime.fromtimestamp(s)
OverflowError: timestamp out of range for platform time_t
>>> t = datetime.datetime(9998,12,12)
>>> s = t.timestamp()
>>> s
760175195728.0
>>> datetime.datetime.fromtimestamp(s)
OverflowError: timestamp out of range for platform time_t

When I repeated the test with sys["_datetime"] = None, both t.timestamp() calls raised OverflowError, which I assume is expected.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24773>
_______________________________________


More information about the Python-bugs-list mailing list