Author pitrou
Recipients pitrou
Date 2017-09-19.13:00:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1505826011.26.0.999867844657.issue31517@psf.upfronthosting.co.za>
In-reply-to
Content
The threading main_thread() instance is associated to the thread that first imports the threading module.  In usual circumstances, this will indeed be the interpreter's main thread.  However, it is not always the case.  See attached reproducer.

$ ./python mainthread2.py 
child thread: <_MainThread(MainThread, started 140399567398656)>
main thread: <_DummyThread(Dummy-1, started daemon 140399588386560)>
Exception ignored in: <module 'threading' from '/home/antoine/cpython/default/Lib/threading.py'>
Traceback (most recent call last):
  File "/home/antoine/cpython/default/Lib/threading.py", line 1268, in _shutdown
    assert tlock.locked()
AssertionError:
History
Date User Action Args
2017-09-19 13:00:11pitrousetrecipients: + pitrou
2017-09-19 13:00:11pitrousetmessageid: <1505826011.26.0.999867844657.issue31517@psf.upfronthosting.co.za>
2017-09-19 13:00:11pitroulinkissue31517 messages
2017-09-19 13:00:11pitroucreate