summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_resource.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-02-04 10:57:16 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-02-04 10:57:16 (GMT)
commitb6a53404b782c74bd9f7817ddb97f33642146d0c (patch)
tree79d7604ba115755b16ce1afe9c555c2f745482aa /Lib/test/test_resource.py
parenta4409c18eb55e3e76110af1ac88d8a8f6001d42f (diff)
parent1d0bb9c8f97b0f4fc6717f73555576f523965e42 (diff)
downloadcpython-b6a53404b782c74bd9f7817ddb97f33642146d0c.zip
cpython-b6a53404b782c74bd9f7817ddb97f33642146d0c.tar.gz
cpython-b6a53404b782c74bd9f7817ddb97f33642146d0c.tar.bz2
Issue #6083: Fix multiple segmentation faults occured when PyArg_ParseTuple
parses nested mutating sequence.
Diffstat (limited to 'Lib/test/test_resource.py')
-rw-r--r--Lib/test/test_resource.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
index 0240c69..bb3ff25 100644
--- a/Lib/test/test_resource.py
+++ b/Lib/test/test_resource.py
@@ -107,6 +107,23 @@ class ResourceTest(unittest.TestCase):
except (ValueError, AttributeError):
pass
+ # Issue 6083: Reference counting bug
+ def test_setrusage_refcount(self):
+ try:
+ limits = resource.getrlimit(resource.RLIMIT_CPU)
+ except AttributeError:
+ pass
+ else:
+ class BadSequence:
+ def __len__(self):
+ return 2
+ def __getitem__(self, key):
+ if key in (0, 1):
+ return len(tuple(range(1000000)))
+ raise IndexError
+
+ resource.setrlimit(resource.RLIMIT_CPU, BadSequence())
+
def test_main(verbose=None):
support.run_unittest(ResourceTest)