Skip to content

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

Merged
serhiy-storchaka merged 3 commits into
python:mainfrom
yilei:ast
Dec 25, 2023
Merged

gh-106905: Use separate structs to track recursion depth in each PyAST_mod2obj call.#113035
serhiy-storchaka merged 3 commits into
python:mainfrom
yilei:ast

Conversation

@yilei

@yilei yilei commented Dec 13, 2023

Copy link
Copy Markdown
Contributor

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

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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 <yileiyang@google.com>
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
@bedevere-app

bedevere-app Bot commented Dec 25, 2023

Copy link
Copy Markdown

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 <yileiyang@google.com>
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
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 <storchaka@gmail.com>
Co-authored-by: Yilei Yang <yileiyang@google.com>
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
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 <yileiyang@google.com>
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
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] <greg@krypto.org>
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] <greg@krypto.org>
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] <greg@krypto.org>
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] <greg@krypto.org>
@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
@yilei yilei deleted the ast branch March 12, 2026 15:36
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