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 "", line 1, in KeyError not:: Traceback (most recent call last): File "", line 1, in KeyError
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); }
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.
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.