Bugs item #1501934, was opened at 2006-06-07 01:57 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1501934&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Parser/Compiler Group: Python 2.5 Status: Open Resolution: None Priority: 6 Submitted By: Thomas Wouters (twouters) Assigned to: Neal Norwitz (nnorwitz) Summary: incorrect LOAD/STORE_GLOBAL generation Initial Comment: 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. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1501934&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com