-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
gh-125286: Share the Main Refchain With Legacy Interpreters #125709
gh-125286: Share the Main Refchain With Legacy Interpreters #125709
Conversation
Rather than open-code the Py_RTFLAGS_USE_MAIN_OBMALLOC flag test in multiple places, I think a helper function is better, something like:
I was working on a similar patch but my approach was to copy the REFCHAIN pointer, e.g.
Is |
+1 I'll do that.
I'm unclear on how that's different from what I've done.
I left it for the sake of the sanity check. Given the lingering pain in this area, especially related to immortal objects, I figured it might not hurt to preserve such checks.
Thanks! Sorry if we ended up duplicating effort. I should have checked with you first. |
I think it's a bit less code and would be a bit faster, since you can just use
Hmm, I think it's a bit confusing to leave it since it really shouldn't be doing anything useful. Or, is there a reason we think it might do something? The second part of the function shouldn't do anything. If
Your code runs without crashing, which is a plus. ;-) I'm glad you made a PR. |
Oh, I missed this part of your code change:
That explains why you're unclear how my code is different. But if you do this in the init, I don't think the check for |
Good point. I'll remove the superfluous calls. |
Also, you're right about |
I realized the problem with dropping all the extra
At step (3) we rely on the feature flags being set, but we don't set them until step (5). Fixing this is a bit messy and may be too much to backport, so I'd like to merge this fix with the various |
This reverts commit 3421a19.
It wasn't as bad as I thought, so I believe I've got things in a good place here. |
!buildbot AMD64 Arch Linux TraceRefs |
🤖 New build scheduled with the buildbot fleet by @ericsnowcurrently for commit 7ab086c 🤖 The command will test the builders whose names match following regular expression: The builders matched are:
|
I think this change should have a What's New entry, which in turn needs documentation for |
I'm fine with that. |
!buildbot AMD64 Arch Linux TraceRefs |
🤖 New build scheduled with the buildbot fleet by @ericsnowcurrently for commit 1360d86 🤖 The command will test the builders whose names match following regular expression: The builders matched are:
|
One more doc fix in a place where I couldn't add a GitHub suggestion. I hope you don't mind me pushing this directly to the PR. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Thank you @nascheme & @ericsnowcurrently!
@nascheme, this should be backported to 3.13 (and 3.12), right? |
…ers (pythongh-125709) They used to be shared, before 3.12. Returning to sharing them resolves a failure on Py_TRACE_REFS builds.
…gh-124865) (gh-125709) (GH-125204) * gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (gh-124865) 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 interpreter that created and interned it. For interpreters that share obmalloc state, also share the interned dict with the main interpreter. This is an un-revert of gh-124646 that then addresses the Py_TRACE_REFS failures identified by gh-124785. (cherry picked from commit f2cb399) Co-authored-by: Eric Snow <[email protected]> * [3.13] gh-125286: Share the Main Refchain With Legacy Interpreters (gh-125709) They used to be shared, before 3.12. Returning to sharing them resolves a failure on Py_TRACE_REFS builds. --------- Co-authored-by: Eric Snow <[email protected]>
…ers (pythongh-125709) They used to be shared, before 3.12. Returning to sharing them resolves a failure on Py_TRACE_REFS builds.
…gh-125205) 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 interpreter that created and interned it. For interpreters that share obmalloc state, also share the interned dict with the main interpreter. This is an un-revert of gh-124646 that then addresses the Py_TRACE_REFS failures identified by gh-124785 (i.e. backporting gh-125709 too). (cherry picked from commit f2cb399, AKA gh-124865) Co-authored-by: Eric Snow <[email protected]>
…thongh-125709) They used to be shared, before 3.12. Returning to sharing them resolves a failure on Py_TRACE_REFS builds. Co-authored-by: Petr Viktorin <[email protected]>
They used to be shared, before 3.12. Returning to sharing them resolves a failure on
Py_TRACE_REFS
builds.