]> granicus.if.org Git - python/commitdiff
Fix test_datetime on Windows
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 10 Feb 2017 11:37:21 +0000 (12:37 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 10 Feb 2017 11:37:21 +0000 (12:37 +0100)
Issue #29100: On Windows, datetime.datetime.fromtimestamp(min_ts) fails with an
OSError in test_timestamp_limits().

Lib/test/datetimetester.py

index 42944a2d0698a7d033ee3568f5c7eb3dd300cb08..2350125f6d6dbec2dbaae9113e1a17f9b54cfd7b 100644 (file)
@@ -1997,8 +1997,9 @@ class TestDateTime(TestDate):
             # date 0001-01-01 00:00:00+00:00: timestamp=-62135596800
             self.assertEqual(self.theclass.fromtimestamp(min_ts, tz=timezone.utc),
                              min_dt)
-        except OverflowError as exc:
-            # the date 0001-01-01 doesn't fit into 32-bit time_t
+        except (OverflowError, OSError) as exc:
+            # the date 0001-01-01 doesn't fit into 32-bit time_t,
+            # or platform doesn't support such very old date
             self.skipTest(str(exc))
 
         # maximum timestamp: set seconds to zero to avoid rounding issues