Index: Modules/timemodule.c =================================================================== --- Modules/timemodule.c (revision 55520) +++ Modules/timemodule.c (working copy) @@ -603,8 +603,11 @@ buf = *localtime(&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;