summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sys.py
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2011-12-07 20:46:48 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2011-12-07 20:46:48 (GMT)
commit4bf21e28dfb42c2da3d440c2c0d9898cb3196fe1 (patch)
treeb9fafb7a2350a27b2cf59a1ecfb84986601b65cd /Lib/test/test_sys.py
parenta94b578431725ea50381e7d31ff5580741593398 (diff)
downloadcpython-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.py12
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")