STINNER Victor <victor.stin...@haypocalc.com> added the comment: You can reproduce the bug with:
$ lang=fr_fr.iso885...@euro ./python -c 'import pdb; pdb.Pdb(nosigint=True).run("exec(%r)" % "x=12")' > /home/haypo/prog/SVN/py3k/Lib/encodings/iso8859_15.py(15)decode() -> return codecs.charmap_decode(input,errors,decoding_table) (Pdb) quit (it should print "x=12" in the backtrace, not ...iso8859_15.py...) Simplified C backtrace: builtin_exec() -> PyRun_StringFlags() -> PyAST_CompileEx() -> makecode() -> PyUnicode_DecodeFSDefault(). ISO-8859-15 codec is implemented in Python whereas ASCII, ISO-8859-1 and UTF-8 are implemented in C. Pdb stops at the first Python instruction. The user expects that the first instruction is "x=12", but no, the real first Python instruction is calling ISO-8859-15 to decode the byte string "<string>" (script filename). I see two solutions: - set the trace function later. Eg. replace exec(cmd, ...) by code=compile(cmd, ...) + exec(code) and set the trace function after the call to compile. I don't know if both codes are equivalent. - reimplement ISO-8859-15 in Python: it doesn't solve the issue, there are other encodings implemented in Python ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10492> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com