Skip to content

Commit 2a35c93

Browse files
committed
Fix test_datetime on Windows
Issue #29100: On Windows, datetime.datetime.fromtimestamp(min_ts) fails with an OSError in test_timestamp_limits().
1 parent 6f37e36 commit 2a35c93

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/test/datetimetester.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,8 +1997,9 @@ def test_timestamp_limits(self):
19971997
# date 0001-01-01 00:00:00+00:00: timestamp=-62135596800
19981998
self.assertEqual(self.theclass.fromtimestamp(min_ts, tz=timezone.utc),
19991999
min_dt)
2000-
except OverflowError as exc:
2001-
# the date 0001-01-01 doesn't fit into 32-bit time_t
2000+
except (OverflowError, OSError) as exc:
2001+
# the date 0001-01-01 doesn't fit into 32-bit time_t,
2002+
# or platform doesn't support such very old date
20022003
self.skipTest(str(exc))
20032004

20042005
# maximum timestamp: set seconds to zero to avoid rounding issues

0 commit comments

Comments
 (0)