mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Issue #6083: Fix multiple segmentation faults occured when PyArg_ParseTuple
parses nested mutating sequence.
This commit is contained in:
parent
f727c31133
commit
a07a8b4f18
7 changed files with 116 additions and 15 deletions
|
@ -151,6 +151,23 @@ class TestPartial(unittest.TestCase):
|
|||
f_copy = pickle.loads(pickle.dumps(f))
|
||||
self.assertEqual(signature(f), signature(f_copy))
|
||||
|
||||
# Issue 6083: Reference counting bug
|
||||
def test_setstate_refcount(self):
|
||||
class BadSequence:
|
||||
def __len__(self):
|
||||
return 4
|
||||
def __getitem__(self, key):
|
||||
if key == 0:
|
||||
return max
|
||||
elif key == 1:
|
||||
return tuple(range(1000000))
|
||||
elif key in (2, 3):
|
||||
return {}
|
||||
raise IndexError
|
||||
|
||||
f = self.thetype(object)
|
||||
self.assertRaises(SystemError, f.__setstate__, BadSequence())
|
||||
|
||||
class PartialSubclass(functools.partial):
|
||||
pass
|
||||
|
||||
|
@ -164,6 +181,7 @@ class TestPythonPartial(TestPartial):
|
|||
|
||||
# the python version isn't picklable
|
||||
def test_pickle(self): pass
|
||||
def test_setstate_refcount(self): pass
|
||||
|
||||
class TestUpdateWrapper(unittest.TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue