[3.12] gh-116510: Fix a crash due to shared immortal interned strings. - #124541
Conversation
Fix a crash caused by immortal interned strings being shared between sub-interpreters that use basic single-phase init. In that case, the string can be used by an interpreter that outlives the interpeter that created and interned it. For interpreters that share obmalloc state, also share the interned dict with the main interpreter.
ericsnowcurrently
left a comment
There was a problem hiding this comment.
Mostly LGTM
I think there are just a couple spots where we need to clear the PyInterpreterState field for the shared interned dict case.
|
When you're done making the requested changes, leave the comment: |
|
I have made the requested changes; please review again |
|
Thanks for making the requested changes! @ericsnowcurrently: please review the changes made to this pull request. |
|
…terned strings. (pythongh-124541)" This reverts commit 5dd07eb.

Fix a crash caused by immortal interned strings being shared between sub-interpreters that use basic single-phase init. In that case, the string can be used by an interpreter that outlives the interpeter that created and
interned it. For interpreters that share obmalloc state, also share the interned dict with the main interpreter.