Skip to content

Commit 9202447

Browse files
committed
Make Lib/datetime.py use a platform check
1 parent 636ec5d commit 9202447

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

Lib/datetime.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import time as _time
88
import math as _math
9+
import sys
910

1011
def _cmp(x, y):
1112
return 0 if x == y else 1 if x > y else -1
@@ -1577,11 +1578,8 @@ def _fromtimestamp(cls, t, utc, tz):
15771578
# thus we can't perform fold detection for values of time less
15781579
# than the max time fold. See comments in _datetimemodule's
15791580
# version of this method for more details.
1580-
try:
1581-
converter(-1)
1582-
except OSError:
1583-
if t < max_fold_seconds:
1584-
return result
1581+
if sys.platform.startswith("win") and t < max_fold_seconds:
1582+
return result
15851583

15861584
y, m, d, hh, mm, ss = converter(t - max_fold_seconds)[:6]
15871585
probe1 = cls(y, m, d, hh, mm, ss, us, tz)

Lib/test/datetimetester.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def test_name_cleanup(self):
7070
if not name.startswith('__') and not name.endswith('__'))
7171
allowed = set(['MAXYEAR', 'MINYEAR', 'date', 'datetime',
7272
'datetime_CAPI', 'time', 'timedelta', 'timezone',
73-
'tzinfo'])
73+
'tzinfo', 'sys'])
7474
self.assertEqual(names - allowed, set([]))
7575

7676
def test_divide_and_round(self):

0 commit comments

Comments
 (0)