New submission from Antoine Pitrou: 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)> ---------- components: Library (Lib) files: mainthread.py messages: 302515 nosy: asvetlov, pitrou, tim.peters priority: normal severity: normal stage: needs patch status: open title: current_thread() becomes "dummy" thread during shutdown type: behavior versions: Python 3.6, Python 3.7 Added file: https://bugs.python.org/file47152/mainthread.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31516> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com