Skip to content

Commit

Permalink
Issue python#24773: Fixed tests failures on systems with 32-bit time_t.
Browse files Browse the repository at this point in the history
Several 32-bit systems have issues with transitions in the year
2037. This is a bug in the system C library since time_t does not
overflow until 2038, but let's skip tests starting from 2037 to work
around those bugs.
  • Loading branch information
abalkin committed Jul 26, 2016
1 parent 8d49896 commit 611adf2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Lib/test/datetimetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import random
import struct
import unittest
import sysconfig

from array import array

Expand Down Expand Up @@ -4675,6 +4676,7 @@ class ZoneInfoTest(unittest.TestCase):
zonename = 'America/New_York'

def setUp(self):
self.sizeof_time_t = sysconfig.get_config_var('SIZEOF_TIME_T')
if sys.platform == "win32":
self.skipTest("Skipping zoneinfo tests on Windows")
try:
Expand Down Expand Up @@ -4750,6 +4752,9 @@ def test_system_transitions(self):
if self.zonename == 'Europe/Tallinn' and udt.date() == date(1999, 10, 31):
print("Skip %s %s transition" % (self.zonename, udt))
continue
if self.sizeof_time_t == 4 and udt.year >= 2037:
print("Skip %s %s transition for 32-bit time_t" % (self.zonename, udt))
continue
s0 = (udt - datetime(1970, 1, 1)) // SEC
ss = shift // SEC # shift seconds
for x in [-40 * 3600, -20*3600, -1, 0,
Expand Down

0 comments on commit 611adf2

Please sign in to comment.