Skip to content

Commit 8ec0eca

Browse files
committed
remove hacks for previous windows negative timestamp behavior
1 parent c8eab29 commit 8ec0eca

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

Modules/_datetimemodule.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5584,22 +5584,7 @@ datetime_from_timet_and_us(PyTypeObject *cls, TM_FUNC f, time_t timet, int us,
55845584
second = Py_MIN(59, tm.tm_sec);
55855585

55865586
/* local timezone requires to compute fold */
5587-
if (tzinfo == Py_None && f == _PyTime_localtime
5588-
/* On Windows, passing a negative value to local results
5589-
* in an OSError because localtime_s on Windows does
5590-
* not support negative timestamps. Unfortunately this
5591-
* means that fold detection for time values between
5592-
* 0 and max_fold_seconds will result in an identical
5593-
* error since we subtract max_fold_seconds to detect a
5594-
* fold. However, since we know there haven't been any
5595-
* folds in the interval [0, max_fold_seconds) in any
5596-
* timezone, we can hackily just forego fold detection
5597-
* for this time range.
5598-
*/
5599-
#ifdef MS_WINDOWS
5600-
&& (timet - max_fold_seconds > 0)
5601-
#endif
5602-
) {
5587+
if (tzinfo == Py_None && f == _PyTime_localtime) {
56035588
long long probe_seconds, result_seconds, transition;
56045589

56055590
result_seconds = utc_to_seconds(year, month, day,

0 commit comments

Comments
 (0)