STINNER Victor <[EMAIL PROTECTED]> added the comment:

Here is a new version of _Py_DisplaySourceLine() using 
PyTokenizer_FindEncoding() to read the coding header, and 
PyFile_FromFd() to create an "unicode-awake" file. The code could be 
optimized, but it least it displays correctly the file line ;-)

The code is based on the original _Py_DisplaySourceLine() and 
call_find_module() (import.c).

Notes:
* The code is young and new, it might be delayed until python 3.1
* Some functions may raise new exceptions (eg. MemoryError). I don't 
know how Python will react if an exception is raised during 
PyTraceBack_Print() ?
* The return code is 0 for success, but is it -1 or 1 for an error? It 
looks like error is "result != 0", so both -1 and 1 should be valid. I 
used -1.

----------
keywords: +patch
Added file: http://bugs.python.org/file11611/traceback_unicode.patch

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3975>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to