8000 gh-132744: Check recursion limit in _PY_FRAME_GENERAL by Fidget-Spinner · Pull Request #132746 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-132744: Check recursion limit in _PY_FRAME_GENERAL #132746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Check recursion limit in _PY_FRAME_GENERAL
  • Loading branch information
Fidget-Spinner committed Apr 20, 2025
commit b4434ad3f8ce8e40df45fed78c73942f2a3cce92
2 changes: 1 addition & 1 deletion Include/internal/pycore_uop_metadata.h

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

7 changes: 7 additions & 0 deletions Lib/test/test_opcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,13 @@ def instantiate():
with self.assertRaises(TypeError):
instantiate()

def test_recursion_check_for_general_calls(self):
def test(default=None):
return test()

with self.assertRaises(RecursionError):
test()


def make_deferred_ref_count_obj():
"""Create an object that uses deferred reference counting.
Expand Down
1 change: 1 addition & 0 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -3756,6 +3756,7 @@ dummy_func(
macro(INSTRUMENTED_CALL) = unused/3 + _MAYBE_EXPAND_METHOD + _MONITOR_CALL + _DO_CALL + _CHECK_PERIODIC;

op(_PY_FRAME_GENERAL, (callable, self_or_null, args[oparg] -- new_frame: _PyInterpreterFrame*)) {
DEOPT_IF(tstate->py_recursion_remaining <= 1);
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);

// oparg counts all of the args, but *not* self:
Expand Down
4 changes: 4 additions & 0 deletions Python/executor_cases.c.h

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

10 changes: 10 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
0