mirror of
https://github.com/python/cpython.git
synced 2025-11-27 21:55:35 +00:00
#2957: marshal recursion limit exceeded when importing a large .pyc file
This commit is contained in:
parent
954aa943f1
commit
74c71f5a62
3 changed files with 10 additions and 2 deletions
|
|
@ -113,6 +113,12 @@ class CodeTestCase(unittest.TestCase):
|
||||||
new = marshal.loads(marshal.dumps(co))
|
new = marshal.loads(marshal.dumps(co))
|
||||||
self.assertEqual(co, new)
|
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):
|
class ContainerTestCase(unittest.TestCase, HelperMixin):
|
||||||
d = {'astring': 'foo@bar.baz.spam',
|
d = {'astring': 'foo@bar.baz.spam',
|
||||||
'afloat': 7283.43,
|
'afloat': 7283.43,
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,10 @@ What's new in Python 3.0b1?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #2957: Corrected a ValueError "recursion limit exceeded", when
|
||||||
|
unmarshalling many code objects, which happens when importing a
|
||||||
|
large .pyc file (~1000 functions).
|
||||||
|
|
||||||
- Issue #2963: fix merging oversight that disabled method cache for
|
- Issue #2963: fix merging oversight that disabled method cache for
|
||||||
all types.
|
all types.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -913,8 +913,6 @@ r_object(RFILE *p)
|
||||||
Py_XDECREF(filename);
|
Py_XDECREF(filename);
|
||||||
Py_XDECREF(name);
|
Py_XDECREF(name);
|
||||||
Py_XDECREF(lnotab);
|
Py_XDECREF(lnotab);
|
||||||
|
|
||||||
return v;
|
|
||||||
}
|
}
|
||||||
retval = v;
|
retval = v;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue