Attaching reproducer. During interpreter shutdown, threading.main_thread() gets marked "stopped" (while it's obviously still running), while threading.current_thread() returns a DummyThread instance with the same ident as the main thread.
$ ./python mainthread.py
-- before shutdown --
GC in thread <_MainThread(MainThread, started 140359122872064)>
main thread is <_MainThread(MainThread, started 140359122872064)>
-- during shutdown --
GC in thread <_DummyThread(Dummy-1, started daemon 140359122872064)>
main thread is <_MainThread(MainThread, stopped 140359122872064)>
The main thread being marked "stopped" at shutdown might be an obscure feature (as hinted in the comments for threading._shutdown()). However, current_thread() should definitely not return a separate DummyThread instance.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
The text was updated successfully, but these errors were encountered: