]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-124375: Avoid calling `_PyMem_ProcessDelayed` on other thread states (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 15 Oct 2024 17:35:28 +0000 (19:35 +0200)
committerGitHub <noreply@github.com>
Tue, 15 Oct 2024 17:35:28 +0000 (13:35 -0400)
commit4d83f6ddc413204943097699ef84a30356ba8cce
tree041220441f573188d2016c3dbfdd21c2087f95fe
parent6c79baea4dbd0497253015bb8e8ffe96c39c31b0
[3.13] gh-124375: Avoid calling `_PyMem_ProcessDelayed` on other thread states (GH-124459) (#125540)

This fixes a crash when running the PyO3 test suite on the free-threaded
build. The `qsbr` field is initialized after the `PyThreadState` is
added to the interpreter's linked list -- it might still be NULL.

Instead, we "steal" the queue of to-be-freed memory blocks. This is
always initialized (possibly empty) and protected by the stop the world
pause.
(cherry picked from commit 54c6fcbefd33a8d8bf8c004cf1aad3be3d37b933)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Misc/NEWS.d/next/Core_and_Builtins/2024-10-15-15-29-41.gh-issue-124375.wNrWVa.rst [new file with mode: 0644]
Python/gc_free_threading.c