[Python-checkins] cpython: Avoid a glibc bug in test_time (issue #13309)

antoine.pitrou python-checkins at python.org
Fri Nov 11 03:09:10 CET 2011


http://hg.python.org/cpython/rev/05164831011e
changeset:   73490:05164831011e
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Fri Nov 11 03:04:35 2011 +0100
summary:
  Avoid a glibc bug in test_time (issue #13309)

files:
  Lib/test/test_time.py |  8 +++++---
  1 files changed, 5 insertions(+), 3 deletions(-)


diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -5,6 +5,7 @@
 import sysconfig
 import sys
 import warnings
+import platform
 
 # Max year is only limited by the size of C int.
 SIZEOF_INT = sysconfig.get_config_var('SIZEOF_INT') or 4
@@ -313,13 +314,14 @@
         # It may not be possible to reliably make mktime return error
         # on all platfom.  This will make sure that no other exception
         # than OverflowError is raised for an extreme value.
+        if platform.libc_ver()[0] == 'glibc':
+            # Issue #13309: passing extreme values to mktime() or localtime()
+            # borks the glibc's internal timezone data.
+            return
         try:
             time.mktime((-1, 1, 1, 0, 0, 0, -1, -1, -1))
         except OverflowError:
             pass
-        msg = "Issue #13309: the '%Z' specifier reports erroneous timezone"
-        msg += " after time.mktime((-1, 1, 1, 0, 0, 0, -1, -1, -1))."
-        self.assertEqual(time.strftime('%Z', tt), tzname, msg)
 
 
 class TestLocale(unittest.TestCase):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list