New submission from Antoine Pitrou:
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:
----------
files: mainthread2.py
messages: 302521
nosy: pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: MainThread association logic is fragile
type: behavior
versions: Python 3.6, Python 3.7
Added file: https://bugs.python.org/file47153/mainthread2.py
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue31517>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com