[issue3975] PyTraceBack_Print() doesn't respect # coding: xxx header

Amaury Forgeot d'Arc report at bugs.python.org
Wed Oct 8 02:07:36 CEST 2008


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

One last thing: there is a path where lineobj is not freed (when PyUnicode_Check(lineobj) is false); I suggest to move 
Py_XDECREF(lineobj) just before the final return statement.
Reference counting is fun ;-)

> Should I stop on the first error instead of using PyErr_Clear()?
> I would like to display the traceback even if an function failed.
You are right. Common failures should clear the error and return 0.
In your patch, there is one remaining place, the call to PyFile_GetLine().

More fun will arise when my Windows terminal (encoding=cp1252) will try 
to display Chinese characters. Let's pretend this is yet another issue.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3975>
_______________________________________


More information about the Python-bugs-list mailing list