New submission from Martin Panter:
If the exception argument is None or repr(None), it is omitted from the report
when a thread raises an unhandled exception:
>>> def raise_exception(e):
... raise e
...
>>> t = Thread(target=raise_exception, args=(Exception(None),)); t.start();
>>> t.join()
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/proj/python/cpython/Lib/threading.py", line 916, in
_bootstrap_inner
self.run()
File "/home/proj/python/cpython/Lib/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "<stdin>", line 2, in raise_exception
Exception
>>> t = Thread(target=raise_exception, args=(Exception("None"),)); t.start();
>>> t.join()
Exception in thread Thread-2:
Traceback (most recent call last):
File "/home/proj/python/cpython/Lib/threading.py", line 916, in
_bootstrap_inner
self.run()
File "/home/proj/python/cpython/Lib/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "<stdin>", line 2, in raise_exception
Exception
Compare the result with other exception messages, the normal sys.excepthook()
report, and Python 2:
>>> t = Thread(target=raise_exception, args=(Exception("NONE"),)); t.start();
>>> t.join()
Exception in thread Thread-3:
Traceback (most recent call last):
File "/home/proj/python/cpython/Lib/threading.py", line 916, in
_bootstrap_inner
self.run()
File "/home/proj/python/cpython/Lib/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "<stdin>", line 2, in raise_exception
Exception: NONE
>>> raise Exception(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
Exception: None
----------
messages: 268814
nosy: martin.panter
priority: normal
severity: normal
status: open
title: Non-main thread exception handler drops exception message
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue27348>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com