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

STINNER Victor report at bugs.python.org
Wed Oct 8 13:15:28 CEST 2008


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

@amaury: Oops, yes, I introduced a refleak in the version 4 with the 
PyUnicode_Check(). Instead of just moved Py_(X)RECREF(lineobj);, I 
could not not resist to refactor the code to remove one more 
indentation level (I prefer if (...) return; instead of if (...) { 
very long block; }).

Changes in version 5:
 - rename 'namebuf' buffer to 'buf', it's used for the filename and to 
display the indentation space (strcpy(buf, '          ');).
 - move Py_DECREF(fob); at the end of the GetLine loop
 - return on lineobj error

I think that the new version is easier to read than the current code 
because they are few indentation and no more local variables (if (...) 
{ local var; ... })

Added file: http://bugs.python.org/file11747/traceback_unicode-5.patch

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


More information about the Python-bugs-list mailing list