Skip to content

Commit 488bc8b

Browse files
ammaraskarAmmar Askar
authored andcommitted
Add test to ensure there is no OSError for a timestamp of 0
1 parent 8f163d3 commit 488bc8b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Lib/test/datetimetester.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4944,6 +4944,13 @@ def test_fromtimestamp_lord_howe(self):
49444944
self.assertEqual(t0.fold, 0)
49454945
self.assertEqual(t1.fold, 1)
49464946

4947+
4948+
def test_fromtimestamp_low_fold_detection(self):
4949+
# Ensure that fold detection doesn't cause an
4950+
# OSError for really low values, see bpo-29097
4951+
self.assertEqual(datetime.fromtimestamp(0).fold, 0)
4952+
4953+
49474954
@support.run_with_tz('EST+05EDT,M3.2.0,M11.1.0')
49484955
def test_timestamp(self):
49494956
dt0 = datetime(2014, 11, 2, 1, 30)

0 commit comments

Comments
 (0)