-
-
Notifications
You must be signed in to change notification settings - Fork 29.2k
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
current_thread() becomes "dummy" thread during shutdown #75697
Comments
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. |
Tim, any opinion on this one? Do you agree it's an actual bug (if a bit obscure)? |
Ya, it's clearly best for |
I have now pushed the fix to master and 3.6. Hopefully this won't break anyone's code... |
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
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: