This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients brunogola, loewis, pitrou, tim.peters, vstinner
Date 2010-12-11.03:38:49
SpamBayes Score 4.88443e-09
Marked as misclassified No
Message-id <>
You can reproduce the bug with:

$ LANG=fr_FR.iso885915@euro ./python -c 'import pdb; pdb.Pdb(nosigint=True).run("exec(%r)" % "x=12")'
> /home/haypo/prog/SVN/py3k/Lib/encodings/
-> return codecs.charmap_decode(input,errors,decoding_table)
(Pdb) quit

(it should print "x=12" in the backtrace, not

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
Date User Action Args
2010-12-11 03:38:51vstinnersetrecipients: + vstinner, tim.peters, loewis, pitrou, brunogola
2010-12-11 03:38:51vstinnersetmessageid: <>
2010-12-11 03:38:49vstinnerlinkissue10492 messages
2010-12-11 03:38:49vstinnercreate