[Python-bugs-list] [ python-Bugs-409230 ] Python 2.1b1 dumps core on list compr.

noreply@sourceforge.net noreply@sourceforge.net
Mon, 19 Mar 2001 12:43:04 -0800


Bugs item #409230, was updated on 2001-03-16 14:01
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=409230&group_id=5470

Category: Python Interpreter Core
Group: None
>Status: Closed
Priority: 7
Submitted By: Viktor Ferenczi (complex)
Assigned to: Jeremy Hylton (jhylton)
Summary: Python 2.1b1 dumps core on list compr.

Initial Comment:
Hi!

Python 2.1b1 dumps core when executing the following
statement:

print [[y for y in [x,x+1]] for x in [1,3]]

(Should print: [[1,2],[3,4]])

The problem may be related to variable scope resolving
code, because python reports "unknown scope for _[2] in
?(0)" before dumping core. This bug makes impossible to
use a list comprehension as the expression field of
another one.


-Complex-

----------------------------------------------------------------------

>Comment By: Jeremy Hylton (jhylton)
Date: 2001-03-19 12:43

Message:
Logged In: YES 
user_id=31392

Fixed in rev. 2.187 of compile.c


----------------------------------------------------------------------

Comment By: Jeremy Hylton (jhylton)
Date: 2001-03-19 11:49

Message:
Logged In: YES 
user_id=31392

This patch is incorrect.  The root of the problem is that
the symbol table does not have the correct entry for the
nested list comp.  The solution must address the symbol
table problem.


----------------------------------------------------------------------

Comment By: Moshe Zadka (moshez)
Date: 2001-03-18 03:15

Message:
Logged In: YES 
user_id=11645

Here is a patch to fix the problem.


----------------------------------------------------------------------

Comment By: Michael Hudson (mwh)
Date: 2001-03-18 02:34

Message:
Logged In: YES 
user_id=6656

Well, no, it's not the same test case, but it is the same
problem.  It also doesn't crash if you apply patch #406076,
which I wrote to fix #406049.

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-03-17 22:14

Message:
Logged In: YES 
user_id=31435

Assigned to Jeremy.  Boosted priority.  Note that mwh says 
this is a dup of 406049 (but this is clearly not the same 
test case).  Whatever, I confirmed that this specific case 
still crashes.

Fatal Python error: unknown scope for _[2] in ?(0) in 
<stdin>


----------------------------------------------------------------------

Comment By: Michael Hudson (mwh)
Date: 2001-03-17 09:55

Message:
Logged In: YES 
user_id=6656

this is a dup of

[ #406049 ] crash on nested listcomps

so someone with appropriate privilege should mark it as such.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=409230&group_id=5470