Index: Lib/test/test_time.py =================================================================== --- Lib/test/test_time.py (révision 67177) +++ Lib/test/test_time.py (copie de travail) @@ -218,6 +218,15 @@ t1 = time.mktime(lt1) self.assert_(0 <= (t1-t0) < 0.2) + def test_mktime(self): + for epoch, timetuple in ( + ( 1.0, (1970, 1, 1, 1, 0, 1, 3, 1, -1)), + ( 0.0, (1970, 1, 1, 1, 0, 0, 3, 1, -1)), + (-1.0, (1970, 1, 1, 0, 59, 59, 3, 1, -1)), + (-2.0, (1970, 1, 1, 0, 59, 58, 3, 1, -1)), + ): + self.assertEquals(time.mktime(timetuple), epoch) + def test_main(): test_support.run_unittest(TimeTestCase) Index: Modules/timemodule.c =================================================================== --- Modules/timemodule.c (révision 67177) +++ Modules/timemodule.c (copie de travail) @@ -602,8 +602,11 @@ time_t tt; if (!gettmarg(tup, &buf)) return NULL; + + /* invalid value that will not be changed if there is an error. */ + buf.tm_wday = 42; tt = mktime(&buf); - if (tt == (time_t)(-1)) { + if ((tt == (time_t)(-1)) && (buf.tm_wday == 42)) { PyErr_SetString(PyExc_OverflowError, "mktime argument out of range"); return NULL;