This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2016年06月18日 14:57 by martin.panter, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| none-message.patch | martin.panter, 2016年06月29日 09:56 | review | ||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 552 | closed | dstufft, 2017年03月31日 16:36 | |
| Messages (11) | |||
|---|---|---|---|
| msg268814 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2016年06月18日 14:57 | |
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 |
|||
| msg269465 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2016年06月29日 05:00 | |
I traced this back to revision 73afda5a4e4c (Issue 17911), which includes this change to traceback._format_final_exc_line(): -if value is None or not valuestr: +if value == 'None' or value is None or not valuestr: |
|||
| msg269469 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2016年06月29日 09:56 | |
If I remove the value == 'None' check, there are two failures in the test suite: 1. test_decimal fails, but only because the test was changed in revision 5f3dd0a2b1ab to accommodate the very bug I am complaining about. IMO this was a case of "fixing" the test instead of fixing the bug, so it is okay to restore the test. 2. The following test, added in revision ecaafc32c500: def test_without_exception(self): err = traceback.format_exception_only(None, None) self.assertEqual(err, ['None\n']) It was apparently added so that print_exc() would output "None" when called with no exception set. This is the case for Python 2. However in the Python 3 versions I have tried, print_exc() either raises AttributeError or prints "NoneType". In any case, the test does not seem to be testing anything valid according to the documentation, so I propose to remove it. |
|||
| msg269471 - (view) | Author: Robert Collins (rbcollins) * (Python committer) | Date: 2016年06月29日 10:08 | |
hmm, can you give me a change to page this in? I'm pretty sure I saw breakage in external libraries prompting me to add the test and fix. I'd rather not recause that. |
|||
| msg269472 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2016年06月29日 10:09 | |
I agree that ignoring the exception message if str(exc) == 'None' is wrong. |
|||
| msg269473 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2016年06月29日 10:18 | |
Yeah sure I can give you a chance to consider this (I assume you meant "chance" :). But neither of the tests I mentioned were added by you as far as I know. Maybe you are thinking of some other test. |
|||
| msg272494 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2016年08月12日 04:05 | |
Have you had any luck reviewing this Robert? |
|||
| msg276664 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2016年09月16日 02:09 | |
I plan to commit this soon, in time for the next release. |
|||
| msg276679 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2016年09月16日 07:14 | |
"Issue #27348: In the traceback module, restore the formatting of exception messages like "Exception: None". This fixes a regression introduced in 3.5a2." Humn, if it is described as a regression, it means that it's a bug no? You plan to push the change into Python 3.5, 3.6 and 3.7, right? none-message.patch: LGTM. |
|||
| msg276683 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2016年09月16日 08:28 | |
Yes, a bug fix for 3.5+. |
|||
| msg277216 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2016年09月22日 10:56 | |
New changeset 5859a9e8b214 by Martin Panter in branch '3.5': Issue #27348: Restore "Exception: None" formatting in traceback module https://hg.python.org/cpython/rev/5859a9e8b214 New changeset d1455d14accd by Martin Panter in branch '3.6': Issue #27348: Merge exception formatting fix from 3.5 into 3.6 https://hg.python.org/cpython/rev/d1455d14accd New changeset 4261ae29d3e2 by Martin Panter in branch 'default': Issue #27348: Merge exception formatting fix from 3.6 https://hg.python.org/cpython/rev/4261ae29d3e2 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:32 | admin | set | github: 71535 |
| 2017年03月31日 16:36:33 | dstufft | set | pull_requests: + pull_request1064 |
| 2016年09月22日 13:13:08 | martin.panter | set | status: open -> closed resolution: fixed stage: commit review -> resolved |
| 2016年09月22日 10:56:39 | python-dev | set | nosy:
+ python-dev messages: + msg277216 |
| 2016年09月16日 08:28:17 | martin.panter | set | messages: + msg276683 |
| 2016年09月16日 07:14:13 | vstinner | set | messages: + msg276679 |
| 2016年09月16日 02:09:11 | martin.panter | set | stage: patch review -> commit review messages: + msg276664 versions: + Python 3.7 |
| 2016年08月12日 04:05:07 | martin.panter | set | messages: + msg272494 |
| 2016年06月29日 10:18:51 | martin.panter | set | messages: + msg269473 |
| 2016年06月29日 10:09:09 | vstinner | set | nosy:
+ vstinner messages: + msg269472 |
| 2016年06月29日 10:08:58 | rbcollins | set | messages: + msg269471 |
| 2016年06月29日 09:56:27 | martin.panter | set | files:
+ none-message.patch nosy: + rbcollins messages: + msg269469 keywords: + patch stage: patch review |
| 2016年06月29日 05:00:41 | martin.panter | set | title: Non-main thread exception handler drops exception message -> traceback (and threading) drops exception message messages: + msg269465 components: + Library (Lib) keywords: + 3.5regression type: behavior |
| 2016年06月18日 14:57:36 | martin.panter | create | |