#2957: marshal recursion limit exceeded when importing a large .pyc file

This commit is contained in:
Amaury Forgeot d'Arc 2008-05-26 21:41:42 +00:00
parent 954aa943f1
commit 74c71f5a62
3 changed files with 10 additions and 2 deletions

View file

@ -113,6 +113,12 @@ class CodeTestCase(unittest.TestCase):
new = marshal.loads(marshal.dumps(co))
self.assertEqual(co, new)
def test_many_codeobjects(self):
# Issue2957: bad recursion count on code objects
count = 5000 # more than MAX_MARSHAL_STACK_DEPTH
codes = (ExceptionTestCase.test_exceptions.__code__,) * count
marshal.loads(marshal.dumps(codes))
class ContainerTestCase(unittest.TestCase, HelperMixin):
d = {'astring': 'foo@bar.baz.spam',
'afloat': 7283.43,