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 BreamoreBoy, belopolsky, flox, python-dev
Date 2015-03-01.22:30:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1425249058.26.0.276403152484.issue13312@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2015-03-01 22:30:58belopolskysetrecipients: + belopolsky, flox, BreamoreBoy, python-dev
2015-03-01 22:30:58belopolskysetmessageid: <1425249058.26.0.276403152484.issue13312@psf.upfronthosting.co.za>
2015-03-01 22:30:58belopolskylinkissue13312 messages
2015-03-01 22:30:58belopolskycreate