-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-11105: Do not crash when compiling recursive ASTs #20594
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
Conversation
When compiling an AST object with a direct / indirect reference cycles, on the conversion phase because of exceeding amount of calls, a segfault was raised. This patch adds recursion guards to places for preventing user inputs to not to crash AST but instead raise a RecursionError.
I didn't bother with benchmarking extensively though it seems like when compiling python AST objects (only on |
🤖 New build scheduled with the buildbot fleet by @isidentical for commit 9f8c68f 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
@isidentical could you run a quick benchmark to see if this has any effect on the general speed? I expect almost nothing, but is never bad to check |
What do you mean by general speed? This is the code path taken when the python level AST objects ( |
Sorry, I was on my phone and I missed #20594 (comment) 🤦 That was what I was searching for :) |
Thanks @isidentical for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.9. |
Sorry, @isidentical and @pablogsal, I could not cleanly backport this to |
GH-26521 is a backport of this pull request to the 3.10 branch. |
When compiling an AST object with a direct / indirect reference cycles, on the conversion phase because of exceeding amount of calls, a segfault was raised. This patch adds recursion guards to places for preventing user inputs to not to crash AST but instead raise a RecursionError. (cherry picked from commit f349124) Co-authored-by: Batuhan Taskaya <[email protected]>
@isidentical Can you do the manual backport to 3.9? |
Yeah, sure! |
When compiling an AST object with a direct / indirect reference cycles, on the conversion phase because of exceeding amount of calls, a segfault was raised. This patch adds recursion guards to places for preventing user inputs to not to crash AST but instead raise a RecursionError. (cherry picked from commit f349124) Co-authored-by: Batuhan Taskaya <[email protected]>
GH-26522 is a backport of this pull request to the 3.9 branch. |
…-20594) When compiling an AST object with a direct / indirect reference cycles, on the conversion phase because of exceeding amount of calls, a segfault was raised. This patch adds recursion guards to places for preventing user inputs to not to crash AST but instead raise a RecursionError.. (cherry picked from commit f349124) Co-authored-by: Batuhan Taskaya <[email protected]>
GH-26522) When compiling an AST object with a direct / indirect reference cycles, on the conversion phase because of exceeding amount of calls, a segfault was raised. This patch adds recursion guards to places for preventing user inputs to not to crash AST but instead raise a RecursionError.. (cherry picked from commit f349124) Co-authored-by: Batuhan Taskaya <[email protected]>
When compiling AST objects with direct or indirect reference cycles, the converter (python -> native) used to crash. Now it properly manages all the potential calls that might fall into a recursive state with
Py_EnterRecursiveCall
/Py_LeaveRecursiveCall
.https://bugs.python.org/issue11105