Skip to content
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

GH-91079: Decouple C stack overflow checks from Python recursion checks. #96507

Closed
wants to merge 9 commits into from

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Sep 2, 2022

The Python recursion checks work as before.

In addition there is a separate counter for C stack checking which works as follows:

  • There is a fixed limit of 3000 "points".
  • "Normal" C calls that call Py_CheckRecursiveCall() use 1 point.
  • Calls to PyObject_Repr use 2 points as they seem to use a bit more stack than most functions.
  • Calls to _PyEval_EvalFrameDefault use 3 points, as it is a big function and keeps the limit in line with the original limit of 1000
  • The ad-hoc recursion checks in the compiler are replaced with calls to Py_CheckRecursiveCall()

I intend to add PRs to perform real stack checks for the major platforms, but this seems to offer a reasonable approximation for other platforms.

@markshannon
Copy link
Member Author

Closing this as well.
Sorting out the depth handling of the compiler should be done separately.

@markshannon markshannon closed this Sep 2, 2022
@markshannon markshannon deleted the stack-overflow-2 branch September 26, 2023 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants