Closed
Description
Crash report
What happened?
On a free-threaded debug build, even with PYTHON_GIL=1
, it's possible to abort the interpreter by calling _DummyThread._after_fork
after a __reduce__
call:
import threading
obj = threading._DummyThread()
res = obj.__reduce__()
res = obj._after_fork(1)
Abort message:
python: ./Include/internal/pycore_critical_section.h:222: _PyCriticalSection_AssertHeld: Assertion `cs != NULL && cs->_cs_mutex == mutex' failed.
Aborted (core dumped)
Found using fusil by @vstinner.
CPython versions tested on:
3.13, 3.14, CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.14.0a2+ experimental free-threading build (heads/main:0af4ec3, Nov 20 2024, 21:48:16) [GCC 13.2.0]