[Python-bugs-list] [ python-Bugs-471928 ] global made w/nested list comprehensions (original) (raw)
noreply@sourceforge.net noreply@sourceforge.net
Thu, 18 Oct 2001 09:15:24 -0700
- Previous message: [Python-bugs-list] [ python-Bugs-472234 ] type(obj) calls type->tp_init
- Next message: [Python-bugs-list] [ python-Bugs-433625 ] bug in PyThread_release_lock()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Bugs item #471928, was opened at 2001-10-16 18:35 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=105470&aid=471928&group_id=5470
Category: Python Interpreter Core Group: Python 2.2
Status: Closed Resolution: Fixed Priority: 5 Submitted By: Neal Norwitz (nnorwitz) Assigned to: Jeremy Hylton (jhylton) Summary: global made w/nested list comprehensions
Initial Comment: This bug affects Python 2.1.1 & 2.2a4+.
In nested list comprehension code like this:
[bad for s in 'a b' for bad in s.split()]the variable bad becomes a global, but it should be local variable.
The attached file shows the disassembled byte code, along with a test case.
The original source of the error was found from cgi.py:209 in the standard library:
pairs = [s2 for s1 in qs.split('&') for s2 ins1.split(';')]
Neal
Comment By: Jeremy Hylton (jhylton) Date: 2001-10-18 09:15
Message: Logged In: YES user_id=31392
The symbol table pass wasn't visiting nested list comprehenesions. Fixed in rev. 2.227 of compile.c.
Comment By: Tim Peters (tim_one) Date: 2001-10-17 18:22
Message: Logged In: YES user_id=31435
Reassigned to Jeremy, as I expect he's got a better chance of understanding why the symbol-table code is calling one of these local and the other global (listcomp codegen treats them the same).
Comment By: Guido van Rossum (gvanrossum) Date: 2001-10-16 23:06
Message: Logged In: YES user_id=6380
Good catch! I don't know the list comprehension code generation, and I don't know who does. Maybe Thomas Wouters?
You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=105470&aid=471928&group_id=5470
- Previous message: [Python-bugs-list] [ python-Bugs-472234 ] type(obj) calls type->tp_init
- Next message: [Python-bugs-list] [ python-Bugs-433625 ] bug in PyThread_release_lock()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]