[issue31517] MainThread association logic is fragile
Antoine Pitrou
report at bugs.python.org
Tue Sep 19 09:00:11 EDT 2017
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 <report at bugs.python.org>
<https://bugs.python.org/issue31517>
_______________________________________
More information about the Python-bugs-list
mailing list