Skip to content

gh-106905: Use separate structs to track recursion depth in each PyAST_mod2obj call. #113035

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 3 commits into from
Dec 25, 2023

Conversation

yilei
Copy link
Contributor

@yilei yilei commented Dec 13, 2023

This avoids a race condition in PyAST_mod2obj when the GIL could be released due to GC (on Python 3.11).

This should fix #106905.

@gpshead gpshead added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Dec 13, 2023
@gpshead gpshead self-assigned this Dec 13, 2023
Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, so ast_state is a global state? Ah, now I see the mistake.

@miss-islington-app
Copy link

Thanks @yilei for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @yilei and @serhiy-storchaka, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 48c49739f5502fc7aa82f247ab2e4d7b55bdca62 3.12

@miss-islington-app
Copy link

Sorry, @yilei and @serhiy-storchaka, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 48c49739f5502fc7aa82f247ab2e4d7b55bdca62 3.11

serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this pull request Dec 25, 2023
… in each PyAST_mod2obj call. (pythonGH-113035)

(cherry picked from commit 48c4973)

Co-authored-by: Yilei Yang <[email protected]>
Co-authored-by: Gregory P. Smith [Google LLC] <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Dec 25, 2023

GH-113472 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Dec 25, 2023
serhiy-storchaka added a commit that referenced this pull request Dec 25, 2023
…ch PyAST_mod2obj call. (GH-113035) (GH-113472)

(cherry picked from commit 48c4973)

Co-authored-by: Yilei Yang <[email protected]>
Co-authored-by: Gregory P. Smith [Google LLC] <[email protected]>
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Dec 25, 2023
…n depth in each PyAST_mod2obj call. (pythonGH-113035) (pythonGH-113472)

(cherry picked from commit 48c4973)

(cherry picked from commit d58a5f4)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Yilei Yang <[email protected]>
Co-authored-by: Gregory P. Smith [Google LLC] <[email protected]>
serhiy-storchaka added a commit that referenced this pull request Dec 25, 2023
…ch PyAST_mod2obj call. (GH-113035) (GH-113472) (GH-113476)

(cherry picked from commit 48c4973)
(cherry picked from commit d58a5f4)

Co-authored-by: Yilei Yang <[email protected]>
Co-authored-by: Gregory P. Smith [Google LLC] <[email protected]>
ryan-duve pushed a commit to ryan-duve/cpython that referenced this pull request Dec 26, 2023
…h PyAST_mod2obj call. (pythonGH-113035)


Co-authored-by: Gregory P. Smith [Google LLC] <[email protected]>
kulikjak pushed a commit to kulikjak/cpython that referenced this pull request Jan 22, 2024
…h PyAST_mod2obj call. (pythonGH-113035)


Co-authored-by: Gregory P. Smith [Google LLC] <[email protected]>
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
…h PyAST_mod2obj call. (pythonGH-113035)


Co-authored-by: Gregory P. Smith [Google LLC] <[email protected]>
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
…h PyAST_mod2obj call. (pythonGH-113035)


Co-authored-by: Gregory P. Smith [Google LLC] <[email protected]>
@serhiy-storchaka serhiy-storchaka removed their assignment Sep 29, 2024
@serhiy-storchaka serhiy-storchaka removed the needs backport to 3.11 only security fixes label Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error in AST recursion depth tracking change of gh-95185
3 participants