Repository navigation
Move the unref to below the multi-interpreter check. - #6195
Conversation
|
I ran a fable 5.1 xhigh review on this. This also might be related to #6190. 🤖 AI text below 🤖 Top findings
Other findings
The review treats the reorder itself as correct hardening. The main risks are the unexplained root cause of #6174, the residual non-atomic read, and the
Yes. PR #6190 (merged) is exactly the review's third finding: it moves The two PRs are complementary, not duplicates:
Rebasing this branch on master picks up #6190 and clears finding 3. Finding 1 (the review's claim that the reorder cannot reproduce the #6174 test failure) still stands, and #6190's own description also says its explanation of the MinGW failure is unconfirmed. So neither PR has a confirmed repro of #6174 yet. The remaining open items are the non-atomic re-read in |
The internals are not needed here, and this is always the main interpreter (which is sometimes NOT the interpreter we want).
|
So it's an AI battle, then .... Opus 5.5:
So the |
|
I just merged master; there were no conflicts. |
|
I'll add the suggested tests. The build and test log links below are broken, but I'm leaving the codex output as-is for simplicity. codex GPT-6.1-Sol ultra (session ID 01a11ceb-7bdc-78f0-9756-7fc38f0a1ef8): The change looks sound, and I found three deterministic tests that show what it adds after #6190. I reviewed pushed head The initialization reasoning checks out. CPython 3.13+ temporarily switches to the main interpreter for I would add these tests:
All three probes failed on master and passed on the PR, using regular CPython 3.14 and free-threaded 3.14 with
I would retain the existing concurrent-import stress test and run it on the recorded Windows Debug configuration. These deterministic tests establish the changed behavior; they do not identify which race caused the historical #6174 occurrence. General singleton-cache concurrency also remains a broader concern because its pointer accesses are still unsynchronized. The repository is unchanged. The diagnostic source is available for turning these outlines into repository tests. |
|
EDIT: The below was a flake. A rerun worked. FAILED: CI / 🐍 (windows-latest, 3.9, -DPYBIND11_TEST_SMART_HOLDER=ON) / 🧪 |
|
Looks good to me |
Description
This is a fix for #6174.
AI's assessment seems plausible
Moving the unref makes sense. We cannot outright remove the unref, there is a case (covered by the "Restart the interpreter" unit test) which crashes without it.
Suggested changelog entry:
📚 Documentation preview 📚: https://pybind11--6195.org.readthedocs.build/