-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Cannot safely Py_EndInterpreter in 3.14b1 #134144
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
Comments
@ericsnowcurrently This is the I'm pretty sure #128640 will fix this. |
I updated the example code to a complete compilable description, this crashes for me. Using deadsnakes repo on ubuntu 24.04, which is 3.14.b1. |
Huh, that repro looks wrong. |
Does the PyThreadState_Swap not detach it? |
Oh wait, I see that you delete |
If it matters, the reason I am doing it this way is that in 3.12 you can't actually delete (via PyThreadState_Delete) the first PyThreadState of the interpreter ... it looks to me like it never gets zero'd out (because it is the one that has storage inside the interpreterstate) so it causes an abort when it is subsequently reallocated. :( So you have to leave that one allocated. This is fixed in 3.13+ |
(cherry picked from commit f2de1e6) Co-authored-by: b-pass <[email protected]>
Crash report
What happened?
Stack trace:
(note the address passed to tstate_delete_common is definitely corrupt, and not the address of any PyThreadState created in this program)
This was triggered by creating a new PyThreeadState for the interpreter, switching to it, deleting an old thread state for the same interpreter, and then calling Py_EndInterpreter (on the new thread state).
repro.c:
Compiled with
$ gcc -O1 -ggdb repro.cpp -I/usr/include/python3.14 -lpython3.14
CPython versions tested on:
3.14
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.14.0b1 (main, May 8 2025, 08:57:13) [GCC 13.3.0]
Linked PRs
The text was updated successfully, but these errors were encountered: