summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_time.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-11-11 02:04:35 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-11-11 02:04:35 (GMT)
commitb0a1d628b84dad92f4cf0e62987d63f1d8fb3311 (patch)
tree76b03e8fcd52e142ac30ce08250f604895d44ec7 /Lib/test/test_time.py
parent44c6affc796a84cb4b4e89eadd4c923958e9cc99 (diff)
downloadcpython-b0a1d628b84dad92f4cf0e62987d63f1d8fb3311.zip
cpython-b0a1d628b84dad92f4cf0e62987d63f1d8fb3311.tar.gz
cpython-b0a1d628b84dad92f4cf0e62987d63f1d8fb3311.tar.bz2
Avoid a glibc bug in test_time (issue #13309)
Diffstat (limited to 'Lib/test/test_time.py')
-rw-r--r--Lib/test/test_time.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index afdf43e..dd630bd 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -5,6 +5,7 @@ import locale
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 @@ class TimeTestCase(unittest.TestCase):
# 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):