mirror of
https://github.com/python/cpython.git
synced 2025-08-28 12:45:07 +00:00
[3.10] GH-94329: Don't raise on excessive stack consumption (GH-94421) (#94448)
This commit is contained in:
parent
30015de723
commit
b87d03d355
3 changed files with 8 additions and 7 deletions
|
@ -1035,6 +1035,12 @@ class TestExpressionStackSize(unittest.TestCase):
|
||||||
code += " x and x\n" * self.N
|
code += " x and x\n" * self.N
|
||||||
self.check_stack_size(code)
|
self.check_stack_size(code)
|
||||||
|
|
||||||
|
def test_stack_3050(self):
|
||||||
|
M = 3050
|
||||||
|
code = "x," * M + "=t"
|
||||||
|
# This raised on 3.10.0 to 3.10.5
|
||||||
|
compile(code, "<foo>", "single")
|
||||||
|
|
||||||
|
|
||||||
class TestStackSizeStability(unittest.TestCase):
|
class TestStackSizeStability(unittest.TestCase):
|
||||||
# Check that repeating certain snippets doesn't increase the stack size
|
# Check that repeating certain snippets doesn't increase the stack size
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Compile and run code with unpacking of extremely large sequences (1000s of elements).
|
||||||
|
Such code failed to compile. It now compiles and runs correctly.
|
|
@ -6968,13 +6968,6 @@ makecode(struct compiler *c, struct assembler *a, PyObject *consts)
|
||||||
Py_DECREF(consts);
|
Py_DECREF(consts);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (maxdepth > MAX_ALLOWED_STACK_USE) {
|
|
||||||
PyErr_Format(PyExc_SystemError,
|
|
||||||
"excessive stack use: stack is %d deep",
|
|
||||||
maxdepth);
|
|
||||||
Py_DECREF(consts);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
co = PyCode_NewWithPosOnlyArgs(posonlyargcount+posorkeywordargcount,
|
co = PyCode_NewWithPosOnlyArgs(posonlyargcount+posorkeywordargcount,
|
||||||
posonlyargcount, kwonlyargcount, nlocals_int,
|
posonlyargcount, kwonlyargcount, nlocals_int,
|
||||||
maxdepth, flags, a->a_bytecode, consts, names,
|
maxdepth, flags, a->a_bytecode, consts, names,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue