cpython
cpython copied to clipboard
gh-94445: add compiler test for another case of excessive stack use
In GH-94329 the MAX_ALLOWED_STACK_SIZE check in the compiler (added in 3.10.0) was reverted,
because it was discovered that a large sequence unpacking could use more than the allowed stack size.
A todo comment was left in the code to re-add this check in future, and GH-94445 was created to track
the todo item.
I've found another case in which unbounded stack can be consumed: a function with a very large number of type-annotated arguments. This PR simply adds a test for that case, to ensure that if in future the stack-size check is again enforced, the case won't be missed and cause another breakage for valid (if pathological) code.
Thanks @carljm for the PR, and @iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. 🐍🍒⛏🤖
GH-99262 is a backport of this pull request to the 3.11 branch.