]> granicus.if.org Git - python/commitdiff
Merged revisions 77706 via svnmerge from
authorEzio Melotti <ezio.melotti@gmail.com>
Sat, 23 Jan 2010 10:44:47 +0000 (10:44 +0000)
committerEzio Melotti <ezio.melotti@gmail.com>
Sat, 23 Jan 2010 10:44:47 +0000 (10:44 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77706 | ezio.melotti | 2010-01-23 12:43:05 +0200 (Sat, 23 Jan 2010) | 1 line

  Increased the overflow value on test_dealloc to make sure that it is big enough even for wide builds.
........

Lib/test/test_re.py

index c04b626d3cee88287d2c094e4f67ef91d6481c3e..6e302334efc64997c2f1beedcd0b6ab391d8f059 100644 (file)
@@ -688,7 +688,11 @@ class ReTests(unittest.TestCase):
     def test_dealloc(self):
         # issue 3299: check for segfault in debug build
         import _sre
-        long_overflow = sys.maxsize + 2
+        # the overflow limit is different on wide and narrow builds and it
+        # depends on the definition of SRE_CODE (see sre.h).
+        # 2**128 should be big enough to overflow on both. For smaller values
+        # a RuntimeError is raised instead of OverflowError.
+        long_overflow = 2**128
         self.assertRaises(TypeError, re.finditer, "a", {})
         self.assertRaises(OverflowError, _sre.compile, "abc", 0, [long_overflow])