diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2011-12-07 20:46:48 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2011-12-07 20:46:48 (GMT) |
commit | 4bf21e28dfb42c2da3d440c2c0d9898cb3196fe1 (patch) | |
tree | b9fafb7a2350a27b2cf59a1ecfb84986601b65cd /Lib/test/test_sys.py | |
parent | a94b578431725ea50381e7d31ff5580741593398 (diff) | |
download | cpython-4bf21e28dfb42c2da3d440c2c0d9898cb3196fe1.zip cpython-4bf21e28dfb42c2da3d440c2c0d9898cb3196fe1.tar.gz cpython-4bf21e28dfb42c2da3d440c2c0d9898cb3196fe1.tar.bz2 |
Issue #13546: Fixed an overflow issue that could crash the intepreter when
calling sys.setrecursionlimit((1<<31)-1).
2.7 only.
Diffstat (limited to 'Lib/test/test_sys.py')
-rw-r--r-- | Lib/test/test_sys.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 49f5388..6c5fc24 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -224,6 +224,18 @@ class SysModuleTest(unittest.TestCase): self.assertEqual(sys.getrecursionlimit(), 10000) sys.setrecursionlimit(oldlimit) + self.assertRaises(OverflowError, sys.setrecursionlimit, 1 << 31) + try: + sys.setrecursionlimit((1 << 31) - 5) + try: + # issue13546: isinstance(e, ValueError) used to fail + # when the recursion limit is close to 1<<31 + raise ValueError() + except ValueError, e: + pass + finally: + sys.setrecursionlimit(oldlimit) + def test_getwindowsversion(self): # Raise SkipTest if sys doesn't have getwindowsversion attribute test.test_support.get_attribute(sys, "getwindowsversion") |