PEP263 + exec statement

Nick Coghlan ncoghlan at email.com
Fri Nov 26 08:56:47 EST 2004


Carlos Ribeiro wrote:
> Does anyone have more information on this? I have tried Google in
> vain. It seems that exec is not that popular (which is a good sign,
> IMHO), and that nobody else had this problem before.

Does compile() work? (i.e. "bytecode = compile(code_str); exec bytecode" instead 
of "exec code_str").

PEP 263 states explicitly that feeding a unicode string to compile() should 
respect the encoding. It's silence on the question of exec fails to inspire 
confidence. . .

If compile() does work even though exec doesn't, it would explain why exec has 
never been fixed :)

Cheers,
Nick.



More information about the Python-list mailing list