diff -r 1c486516b39e Modules/_datetimemodule.c --- a/Modules/_datetimemodule.c Thu Dec 29 23:57:31 2016 -0700 +++ b/Modules/_datetimemodule.c Fri Dec 30 05:54:55 2016 -0500 @@ -4269,7 +4269,21 @@ */ second = Py_MIN(59, tm.tm_sec); - if (tzinfo == Py_None && f == _PyTime_localtime) { + /* On Windows, passing a negative value to local results + * in an OSError because localtime_s on Windows does + * not support negative timestamps. Unfortunately this + * means that fold detection for time values between + * 0 and max_fold_seconds will result in an identical + * error since we subtract max_fold_seconds to detect a + * fold. However, since we know there haven't been any + * folds in the interval [0, max_fold_seconds) in any + * timezone, we can hackily just forego fold detection + * for this time range on Windows. */ + if (tzinfo == Py_None && f == _PyTime_localtime +#ifdef MS_WINDOWS + && (timet - max_fold_seconds > 0) +#endif + ) { long long probe_seconds, result_seconds, transition; result_seconds = utc_to_seconds(year, month, day,