diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-04 10:45:46 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-04 10:45:46 (GMT) |
commit | a07a8b4f18c9f3a6eb14080dcbef4dc23a2d3f3b (patch) | |
tree | 90dbe40b508a126e0ee9f20b2297995bd5cd67ff /Lib/test/test_resource.py | |
parent | f727c31133822b3e39f851fcca9d3239f389c054 (diff) | |
download | cpython-a07a8b4f18c9f3a6eb14080dcbef4dc23a2d3f3b.zip cpython-a07a8b4f18c9f3a6eb14080dcbef4dc23a2d3f3b.tar.gz cpython-a07a8b4f18c9f3a6eb14080dcbef4dc23a2d3f3b.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.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py index 52692a7..745b26b 100644 --- a/Lib/test/test_resource.py +++ b/Lib/test/test_resource.py @@ -103,6 +103,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): test_support.run_unittest(ResourceTest) |