[issue4626] compile() doesn't ignore the source encoding when a string is passed in

Jean-Michel Fauth report at bugs.python.org
Tue Mar 24 17:24:29 CET 2009


Jean-Michel Fauth <wxjmfauth at gmail.com> added the comment:

I'm glad to have discovered this topic. I bumped into something similar
when I toyed with an interactive interpreter.

from code import InteractiveInterpreter

ii = InteractiveInterpreter()
source = ...
ii.runsource(source)

What should be the encoding and/or the type (str, bytes) of the "source"
string? Taking into account the encoding of the script which contains
this code, I have the feeling there is always something going wrong,
this can be a "non ascii" char in the source (encoded in utf-8!) or the
interactive interpreter does not accept very well a byte string
representing a utf-8 encoded string.

IDLE is not suffering from this. Its interactive interpreter is somehow
receiving "ucs-2 ready string" from tkinter.

I'm a little bit confused here (win2k, winXP sp2, Python 3.0.1).

----------
nosy: +jmfauth

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


More information about the Python-bugs-list mailing list