[Python-Dev] variable name resolution in exec is incorrect

Nick Coghlan ncoghlan at gmail.com
Sat May 29 14:13:24 CEST 2010


On 29/05/10 20:20, Colin H wrote:
> Perhaps the next step is to re-open the issue? If it is seen as a bug,
> it would be great to see a fix in 2.6+ - a number of options which
> will not break backward compatibility have been put forward - cheers,

A new feature request requesting a "closure" mode for compile() in 3.2 
would probably be the best way forward. Once that is done, then the 
question of if or when to change the default behaviour for auto-compiled 
code in exec and/or dis can be considered.

It definitely isn't a bug fix though - it's worked this way for years, 
and while the existing semantics can certainly be surprising, they're 
far from being buggy (as Thomas said, prior to the introduction of 
lexical scoping all Python namespaces worked this way).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------


More information about the Python-Dev mailing list