@@ -192,18 +192,29 @@ def test_gmtime(self):
192192 # (tm_year, tm_mon, tm_mday,
193193 # tm_hour, tm_min, tm_sec,
194194 # tm_wday, tm_yday)
195- for t , expected in (
195+ tests = [
196196 (- 13262400 , (1969 , 7 , 31 , 12 , 0 , 0 , 3 , 212 )),
197197 (- 6177600 , (1969 , 10 , 21 , 12 , 0 , 0 , 1 , 294 )),
198- # non-leap years (pre epoch)
199- (- 2203891200 , (1900 , 3 , 1 , 0 , 0 , 0 , 3 , 60 )),
200- (- 2203977600 , (1900 , 2 , 28 , 0 , 0 , 0 , 2 , 59 )),
201- (- 5359564800 , (1800 , 3 , 1 , 0 , 0 , 0 , 5 , 60 )),
202- (- 5359651200 , (1800 , 2 , 28 , 0 , 0 , 0 , 4 , 59 )),
203198 # leap years (pre epoch)
204199 (- 2077660800 , (1904 , 3 , 1 , 0 , 0 , 0 , 1 , 61 )),
205200 (- 2077833600 , (1904 , 2 , 28 , 0 , 0 , 0 , 6 , 59 )),
206- ):
201+ ]
202+
203+ try :
204+ from _testinternalcapi import SIZEOF_TIME_T
205+ except ImportError :
206+ pass
207+ else :
208+ if SIZEOF_TIME_T >= 8 :
209+ tests .extend ((
210+ # non-leap years (pre epoch)
211+ (- 2203891200 , (1900 , 3 , 1 , 0 , 0 , 0 , 3 , 60 )),
212+ (- 2203977600 , (1900 , 2 , 28 , 0 , 0 , 0 , 2 , 59 )),
213+ (- 5359564800 , (1800 , 3 , 1 , 0 , 0 , 0 , 5 , 60 )),
214+ (- 5359651200 , (1800 , 2 , 28 , 0 , 0 , 0 , 4 , 59 )),
215+ ))
216+
217+ for t , expected in tests :
207218 with self .subTest (t = t , expected = expected ):
208219 res = time .gmtime (t )
209220 self .assertEqual (tuple (res )[:8 ], expected , res )
0 commit comments