diff options
Diffstat (limited to 'Lib/test/test_code.py')
-rw-r--r-- | Lib/test/test_code.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py index 2bdd7e74943..9d6b465115c 100644 --- a/Lib/test/test_code.py +++ b/Lib/test/test_code.py @@ -320,6 +320,15 @@ class CodeTest(unittest.TestCase): with self.assertRaises(ValueError): co.replace(co_nlocals=co.co_nlocals + 1) + def test_shrinking_localsplus(self): + # Check that PyCode_NewWithPosOnlyArgs resizes both + # localsplusnames and localspluskinds, if an argument is a cell. + def func(arg): + return lambda: arg + code = func.__code__ + newcode = code.replace(co_name="func") # Should not raise SystemError + self.assertEqual(code, newcode) + def test_empty_linetable(self): def func(): pass |