Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bpo-47182: Fix crash by named unicode characters after interpreter reinitialization #32212

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 2 commits into from
Mar 31, 2022

Conversation

tiran
Copy link
Member

@tiran tiran commented Mar 31, 2022

https://bugs.python.org/issue47182

Automerge-Triggered-By: GH:tiran

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM, but consider adding a comment ;-)

If you are motivated, you can add a test to test_embed using test_repeated_init_exec: see test_finalize_structseq() of test_embed for example. You can run arbitrary Python code, it's executed multiple times, each time the interpreter is created/destroyed in the same process.

@tiran
Copy link
Member Author

tiran commented Mar 31, 2022

I have added a comment and a test case.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for adding a regression test!

@miss-islington
Copy link
Contributor

@tiran: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 44e9150 into python:main Mar 31, 2022
@miss-islington
Copy link
Contributor

Thanks @tiran for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8, 3.9, 3.10.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @tiran, I could not cleanly backport this to 3.10 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 44e915028d75f7cef141aa1aada962465a5907d6 3.10

@miss-islington miss-islington self-assigned this Mar 31, 2022
@miss-islington
Copy link
Contributor

Sorry @tiran, I had trouble checking out the 3.9 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 44e915028d75f7cef141aa1aada962465a5907d6 3.9

@miss-islington
Copy link
Contributor

Sorry, @tiran, I could not cleanly backport this to 3.8 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 44e915028d75f7cef141aa1aada962465a5907d6 3.8

@miss-islington
Copy link
Contributor

Sorry @tiran, I had trouble checking out the 3.7 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 44e915028d75f7cef141aa1aada962465a5907d6 3.7

@vstinner
Copy link
Member

Are you sure that Python 3.10 and older are affected?

Clearing interned strings is new in Python 3.10. Python 3.11 changed that with immortal code objects and immortal strings.

In Python 3.9, strings were not really cleared by Py_Finalize(). They just leaked.

tiran added a commit to tiran/cpython that referenced this pull request Mar 31, 2022
…eter reinitialization (pythonGH-32212)

Automerge-Triggered-By: GH:tiran.
(cherry picked from commit 44e9150)

Co-authored-by: Christian Heimes <[email protected]>
tiran added a commit to tiran/cpython that referenced this pull request Mar 31, 2022
…ter reinitialization (pythonGH-32212)

Automerge-Triggered-By: GH:tiran.
(cherry picked from commit 44e9150)

Co-authored-by: Christian Heimes <[email protected]>
@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Mar 31, 2022
@bedevere-bot
Copy link

GH-32216 is a backport of this pull request to the 3.10 branch.

@bedevere-bot
Copy link

GH-32217 is a backport of this pull request to the 3.9 branch.

@tiran
Copy link
Member Author

tiran commented Mar 31, 2022

3.9 and earlier are definitely not affected. It doesn't hurt to backport the change to 3.10.

@vstinner
Copy link
Member

3.9 and earlier are definitely not affected. It doesn't hurt to backport the change to 3.10.

Yeah, I agree to backport to 3.10. But you have to backport manually, _testembed doesn't have test_repeated_init_exec.

tiran added a commit that referenced this pull request Apr 1, 2022
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.

5 participants