
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2013-03-16 21:17 bypjenvey, last changed2022-04-11 14:57 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| code.patch | Claudiu.Popa,2013-08-20 22:04 | review | ||
| issue17442.patch | Claudiu.Popa,2014-03-11 21:34 | Remove trailing whitespaces | review | |
| issue17442_1.patch | Claudiu.Popa,2014-03-16 18:20 | Added documentation note regarding this change. | review | |
| issue17442_2.patch | Claudiu.Popa,2014-09-10 12:44 | review | ||
| Messages (16) | |||
|---|---|---|---|
| msg184355 -(view) | Author: Philip Jenvey (pjenvey)*![]() | Date: 2013-03-16 21:17 | |
The code module claims to emulate Python's interactive interpreter but it fails to emulate displaying of the exception cause.It can utilize traceback._iter_chain to do this (see traceback.print_exception) | |||
| msg187275 -(view) | Author: Philip Jenvey (pjenvey)*![]() | Date: 2013-04-18 18:00 | |
PyPy's fixed this here:https://bitbucket.org/pypy/pypy/commits/1341a432e134The tests just need to be adapted to the stdlib test suite | |||
| msg195719 -(view) | Author: PCManticore (Claudiu.Popa)*![]() | Date: 2013-08-20 22:04 | |
Here's an updated patch for the stdlib, with adapted tests. | |||
| msg198837 -(view) | Author: PCManticore (Claudiu.Popa)*![]() | Date: 2013-10-02 13:21 | |
Could anyone review this patch, please? | |||
| msg217103 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2014-04-23 23:45 | |
I am on the fence as to whether this should be treated as a bug fix or enhancement. Claudiu's pydev post gives this as the current InteractiveInterpreter behavior.------------------------------>>> try:... 1 / 0... except ZeroDivisionError as exc:... raise IOError from exc...Traceback (most recent call last): File "<console>", line 4, in <module>OSError-----------------------------------This certainly is not an exact emulation (given below), but is it severe enough to be a bug, and moreover, would fixing it break code?Again from Claudiu's post: with the patch.--------------------------------->>> try:... 1 / 0... except ZeroDivisionError as exc:... raise IOError from exc...Traceback (most recent call last): File "<stdin>", line 2, in <module>ZeroDivisionError: division by zeroThe above exception was the direct cause of the following exception:Traceback (most recent call last): File "<stdin>", line 4, in <module>OSError---------------------------------I verified that this is exactly what 3.4.0 prints for interactive input, But... the Idle Shell also prints the above, plus it adds (or received from the user process) the offending code lines just as when the code is read from a file.... File "<pyshell#0>", line 2, in <module> 1 / 0ZeroDivisionError: division by zero... File "<pyshell#0>", line 4, in <module> raise IOError from excOSErrorIs there a reason the console interpreter cannot do the same? (Changing this would be a different issue, but one this would depend on.) | |||
| msg217115 -(view) | Author: PCManticore (Claudiu.Popa)*![]() | Date: 2014-04-24 04:58 | |
Python's interactive interpreter doesn't show the offending code lines too. And given the fact that code.InteractiveInterpreter tries to be an emulation of the default interpreter, first the change should be addressed directly there, I think. But I agree that it could be useful. | |||
| msg221551 -(view) | Author: R. David Murray (r.david.murray)*![]() | Date: 2014-06-25 14:36 | |
I would lean toward bug fix. I'm sure this was just overlooked when exception chaining was added, and as Claudiu says, the contract of code is to emulate the interactive interpreter, so not doing so in this instance looks like a bug to me.It is certainly conceivable that it could disrupt working programs, but I would think most such would be interactive programs that would benefit from the fix without breaking. Does anyone know of a counter example or can think of a use case for the code module that this change would be likely to break?(Note: if there is a use case that somehow parses the output, introducing blank lines and extra traceback clauses could easily be a breaking change...but is there such a use case?) | |||
| msg221942 -(view) | Author: PCManticore (Claudiu.Popa)*![]() | Date: 2014-06-30 06:08 | |
Well, for instance, my use cases with InteractiveInterpreter are for debugging or creating custom interpreters for various apps and in those cases the patch helps, by giving better debugging clues through the exception cause. I agree that this was overlooked when exception chaining was added. Also, idlelib's PyShell is based on InteractiveInterpreter, but in addition, it implements the exception chaining. | |||
| msg221943 -(view) | Author: PCManticore (Claudiu.Popa)*![]() | Date: 2014-06-30 06:12 | |
Also, solving this issue seems to be, partially, a prerequisite forissue14805. | |||
| msg226683 -(view) | Author: PCManticore (Claudiu.Popa)*![]() | Date: 2014-09-10 06:45 | |
If the patch doesn't need anything else, can it be committed? | |||
| msg226690 -(view) | Author: Berker Peksag (berker.peksag)*![]() | Date: 2014-09-10 12:10 | |
Claudiu, did you see Jim Jewett's review on Rietveld? | |||
| msg226691 -(view) | Author: PCManticore (Claudiu.Popa)*![]() | Date: 2014-09-10 12:27 | |
Actually, no, it seems that I didn't receive any mail regarding them. I'll update the patch accordingly. | |||
| msg226694 -(view) | Author: PCManticore (Claudiu.Popa)*![]() | Date: 2014-09-10 12:44 | |
Here's the new version which fixes the comments from the review. | |||
| msg227802 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2014-09-29 15:26 | |
New changeset2b212a8186e0 by R David Murray in branch 'default':#17442: Add chained traceback support to InteractiveInterpreter.https://hg.python.org/cpython/rev/2b212a8186e0 | |||
| msg227803 -(view) | Author: R. David Murray (r.david.murray)*![]() | Date: 2014-09-29 15:29 | |
After reconsidering Terry's idle example, it seems to me that the change could adversely impact existing code that already works around the lack of chained tracebacks, even as idle does. So I committed this to 3.5 only as an enhancement.Thanks Claudiu.As an aside, isn't it a (pre-existing) bug that if an excepthook exists, it gets passed None for the traceback? | |||
| msg227812 -(view) | Author: PCManticore (Claudiu.Popa)*![]() | Date: 2014-09-29 17:45 | |
Indeed, it's a preexisting bug. I'll try to come up with a patch shortly. | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:42 | admin | set | github: 61644 |
| 2014-09-29 17:45:51 | Claudiu.Popa | set | messages: +msg227812 |
| 2014-09-29 15:29:43 | r.david.murray | set | status: open -> closed versions: - Python 3.4 type: behavior -> enhancement messages: +msg227803 resolution: fixed stage: commit review -> resolved |
| 2014-09-29 15:26:05 | python-dev | set | nosy: +python-dev messages: +msg227802 |
| 2014-09-10 12:44:51 | Claudiu.Popa | set | files: +issue17442_2.patch messages: +msg226694 |
| 2014-09-10 12:27:13 | Claudiu.Popa | set | messages: +msg226691 |
| 2014-09-10 12:10:29 | berker.peksag | set | nosy: +berker.peksag messages: +msg226690 |
| 2014-09-10 06:46:00 | Claudiu.Popa | set | messages: +msg226683 stage: patch review -> commit review |
| 2014-06-30 06:12:11 | Claudiu.Popa | set | messages: +msg221943 |
| 2014-06-30 06:08:16 | Claudiu.Popa | set | messages: +msg221942 |
| 2014-06-25 14:36:35 | r.david.murray | set | messages: +msg221551 |
| 2014-06-25 13:20:29 | Claudiu.Popa | set | nosy: +r.david.murray |
| 2014-04-24 04:58:41 | Claudiu.Popa | set | messages: +msg217115 |
| 2014-04-23 23:45:12 | terry.reedy | set | nosy: +terry.reedy messages: +msg217103 |
| 2014-03-19 20:01:56 | zach.ware | set | versions: + Python 3.5, - Python 3.3 |
| 2014-03-16 18:20:49 | Claudiu.Popa | set | files: +issue17442_1.patch |
| 2014-03-11 21:34:24 | Claudiu.Popa | set | files: +issue17442.patch |
| 2013-10-03 19:34:00 | pitrou | set | nosy: +georg.brandl,serhiy.storchaka |
| 2013-10-02 21:59:56 | pitrou | set | nosy: +pitrou stage: patch review versions: - Python 3.2 |
| 2013-10-02 13:21:26 | Claudiu.Popa | set | messages: +msg198837 |
| 2013-08-20 22:04:11 | Claudiu.Popa | set | files: +code.patch nosy: +Claudiu.Popa messages: +msg195719 keywords: +patch |
| 2013-04-18 18:00:17 | pjenvey | set | messages: +msg187275 |
| 2013-03-16 21:17:44 | pjenvey | create | |