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 2008年04月26日 23:17 by brett.cannon, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (7) | |||
|---|---|---|---|
| msg65855 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2008年04月26日 23:17 | |
The new warnings implementation tweaks how tracebacks are printed. This introduced a bug where the exception name is indented when it shouldn't be: e.g., ``raise KeyError`` should look like:: Traceback (most recent call last): File "<stdin>", line 1, in <module> KeyError not:: Traceback (most recent call last): File "<stdin>", line 1, in <module> KeyError |
|||
| msg65856 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2008年04月26日 23:19 | |
Forgot to mention this is probably from Python/traceback.c:tb_displayline(). |
|||
| msg65857 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2008年04月26日 23:53 | |
It looks like you can just remove the offending line like so: Index: Python/traceback.c =================================================================== --- Python/traceback.c (revision 62515) +++ Python/traceback.c (working copy) @@ -222,8 +222,7 @@ err = PyFile_WriteString(linebuf, f); if (err != 0) return err; - - err = PyFile_WriteString(" ", f); + return Py_DisplaySourceLine(f, filename, lineno); } |
|||
| msg65864 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2008年04月27日 01:24 | |
Yep. I already did that and ran the unit test suite to verify. Now I am just trying to figure out how to best test it. It seems it only comes up for printing a traceback. That would mean either using subprocess to run another interpreter and capture its output or cheat and use ctypes. I don't like either solution. |
|||
| msg65880 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2008年04月27日 09:34 | |
You could add a function to the _testcapi module to invoke PyErr_Display. |
|||
| msg65897 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2008年04月27日 20:04 | |
On Sun, Apr 27, 2008 at 2:34 AM, Georg Brandl <report@bugs.python.org> wrote: > > Georg Brandl <georg@python.org> added the comment: > > You could add a function to the _testcapi module to invoke PyErr_Display. > That's true and probably the only sane idea. |
|||
| msg65910 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2008年04月28日 03:24 | |
Fix in revision 62555. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:33 | admin | set | nosy:
+ barry github: 46951 |
| 2008年04月28日 03:24:19 | brett.cannon | set | status: open -> closed resolution: fixed messages: + msg65910 |
| 2008年04月27日 20:04:24 | brett.cannon | set | messages: + msg65897 |
| 2008年04月27日 09:34:11 | georg.brandl | set | nosy:
+ georg.brandl messages: + msg65880 |
| 2008年04月27日 01:24:55 | brett.cannon | set | messages: + msg65864 |
| 2008年04月26日 23:53:17 | benjamin.peterson | set | nosy:
+ benjamin.peterson messages: + msg65857 |
| 2008年04月26日 23:19:07 | brett.cannon | set | messages: + msg65856 |
| 2008年04月26日 23:17:37 | brett.cannon | create | |