Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions Lib/test/test_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,26 @@ def recurse_kw(a=0):
with self.assertRaises(RecursionError):
recurse_kw()

def test_recursion_with_star_args(self):
# GH-155151: CALL_EX_PY forgot to check the recursion limit.
def recurse_star_args(depth):
if depth:
recurse_star_args(*(depth - 1,))
with set_recursion_limit(50):
with self.assertRaises(RecursionError):
recurse_star_args(100)

def test_recursion_with_bound_method_kwargs(self):
# GH-155151: CALL_KW_BOUND_METHOD forgot to check the recursion limit.
class Recurse:
def recurse(self, depth):
if depth:
recurse_bound_method(depth=depth - 1)
recurse_bound_method = Recurse().recurse
with set_recursion_limit(50):
with self.assertRaises(RecursionError):
recurse_bound_method(100)


class TestFunctionWithManyArgs(unittest.TestCase):
def test_function_with_many_args(self):
Expand Down
16 changes: 16 additions & 0 deletions Modules/_testinternalcapi/test_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -5542,6 +5542,7 @@ dummy_func(
_CHECK_METHOD_VERSION_KW +
_EXPAND_METHOD_KW +
flush + // so that self is in the argument array
_CHECK_RECURSION_REMAINING +
_PY_FRAME_KW +
_SAVE_RETURN_OFFSET +
_PUSH_FRAME;
Expand Down Expand Up @@ -5762,6 +5763,7 @@ dummy_func(
_CHECK_PEP_523 +
_MAKE_CALLARGS_A_TUPLE +
_CHECK_IS_PY_CALLABLE_EX +
_CHECK_RECURSION_REMAINING +
_PY_FRAME_EX +
_SAVE_RETURN_OFFSET +
_PUSH_FRAME;
Expand Down
16 changes: 16 additions & 0 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading