Alexander Belopolsky added the comment:

We still have the following in Lib/test/test_time.py:

        # Issue #13312: it may return wrong value for year < TIME_MINYEAR + 1900
        # Skip the value test, but check that no error is raised
        self.yearstr(TIME_MINYEAR)


I reviewed the current time.asctime() code and it does look like it invokes 
undefined behavior for extremely large negative years.

The problem is that in C struct tm, year is stored as year - 1900 and for year 
< -2147481748 (= -2**31 + 1900) we trigger an overflow of a signed integer.

Can someone confirm that on AMD64 FreeBSD subtracting 1900 from -2147483648 and 
then adding it back does not give -2147483648?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13312>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to