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 mark.dickinson
Recipients ajaksu2, arigo, georg.brandl, hawkett, jhylton, josiahcarlson, mark.dickinson, nickjacobson
Date 2010-05-26.11:40:08
SpamBayes Score 0.00079343905
Marked as misclassified No
Message-id <1274874011.28.0.0768060752351.issue991196@psf.upfronthosting.co.za>
In-reply-to
Content
> I'm guessing that somewhere in the python source there is some code that goes [...]

Unfortunately it's not nearly that simple.  As I mentioned in my message on python-dev, the problem is that 'y' gets bound with a 'STORE_NAME' opcode, which puts 'y' into the locals dict, and then retrieved from within the function with a 'LOAD_GLOBAL' opcode, which looks in the globals dict;  hence the NameError.

So should the compiler be generating a 'LOAD_NAME' instead of a 'LOAD_GLOBAL' for this code?  I'm not really familiar with the compilation process, so I've no idea whether this makes sense, or what impact it might have on existing code.
History
Date User Action Args
2010-05-26 11:40:11mark.dickinsonsetrecipients: + mark.dickinson, jhylton, arigo, georg.brandl, josiahcarlson, nickjacobson, ajaksu2, hawkett
2010-05-26 11:40:11mark.dickinsonsetmessageid: <1274874011.28.0.0768060752351.issue991196@psf.upfronthosting.co.za>
2010-05-26 11:40:09mark.dickinsonlinkissue991196 messages
2010-05-26 11:40:08mark.dickinsoncreate