[issue13312] test_time fails: strftime('%Y', y) for negative year

Martin Panter report at bugs.python.org
Thu Jul 14 01:41:49 EDT 2016


Martin Panter added the comment:

If you enable GCC’s -ftrapv option, the subtraction overflow triggers an abort. Alexander’s patch works around the problem for asctime(), but the problem still exists in other cases, such as:

>>> time.mktime((-2**31 + 1899, *(0,) * 8))
Aborted (core dumped)
[Exit 134]

Attaching a version of the patch without the conflicting whitespace changes.

Why does Python even need to support such extreme time values? It would seem much simpler to raise an exception.

----------
nosy: +martin.panter
Added file: http://bugs.python.org/file43709/issue13312.v2.patch

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


More information about the Python-bugs-list mailing list