Message123771
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/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 |
|
Date |
User |
Action |
Args |
2010-12-11 03:38:51 | vstinner | set | recipients:
+ vstinner, tim.peters, loewis, pitrou, brunogola |
2010-12-11 03:38:51 | vstinner | set | messageid: <1292038731.53.0.626465346525.issue10492@psf.upfronthosting.co.za> |
2010-12-11 03:38:49 | vstinner | link | issue10492 messages |
2010-12-11 03:38:49 | vstinner | create | |
|