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 loewis
Recipients amaury.forgeotdarc, fijal, jhylton, loewis
Date 2009-04-01.04:15:22
SpamBayes Score 4.8942766e-08
Marked as misclassified No
Message-id <1238559323.92.0.189844080922.issue5578@psf.upfronthosting.co.za>
In-reply-to
Content
Reopening. The following piece of code changed it behavior between 2.5 
and 2.6:

def f():
  a = 2
  class C:
    exec 'a = 42'
    abc = a
  return C

print f().abc

In 2.6, this returns 2, because static analysis determines that the read 
of 'a' comes from f's closure, yet the exec gets a new set of locals for 
the body of C where it stores into.

This is highly counter-intuitive. For functions, the issue is resolved 
by banning exec; the same should (now) happen for classes.
History
Date User Action Args
2009-04-01 04:15:24loewissetrecipients: + loewis, jhylton, amaury.forgeotdarc, fijal
2009-04-01 04:15:23loewissetmessageid: <1238559323.92.0.189844080922.issue5578@psf.upfronthosting.co.za>
2009-04-01 04:15:22loewislinkissue5578 messages
2009-04-01 04:15:22loewiscreate