homepage

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 twouters
Recipients
Date 2006年06月06日.23:57:54
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Python 2.5 compiles the following piece of code
differently than Python 2.4:
g = 1
def f():
 g += 1
In Python 2.4, this raises an UnboundLocalError. In
current svn trunk, it will increment the global g by 1.
(dis.dis shows that it actually compiles into
LOAD/STORE_GLOBAL opcodes.) It seems the compiler
doesn't treat augmented assignment as assignment for
the purpose of determining locals, as this still fails
correctly:
g = 1
def f():
 g += 1
 g = 5
I can't find where this optimization happens nowadays,
but it feels like a short fix.
History
Date User Action Args
2007年08月23日 14:40:26adminlinkissue1501934 messages
2007年08月23日 14:40:26admincreate

AltStyle によって変換されたページ (->オリジナル) /