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.

classification
Title: Python 2.1b1 dumps core on list compr.
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jhylton Nosy List: complex, jhylton, moshez, mwh, tim.peters
Priority: high Keywords:

Created on 2001-03-16 22:01 by complex, last changed 2022-04-10 16:03 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
compile_patch moshez, 2001-03-18 11:15 Patch to fix the bug
Messages (7)
msg3889 - (view) Author: Viktor Ferenczi (complex) Date: 2001-03-16 22:01
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-
msg3890 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2001-03-17 17:55
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.
msg3891 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2001-03-18 06:14
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>
msg3892 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2001-03-18 10:34
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.
msg3893 - (view) Author: Moshe Zadka (moshez) (Python triager) Date: 2001-03-18 11:15
Logged In: YES 
user_id=11645

Here is a patch to fix the problem.
msg3894 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2001-03-19 19:49
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.
msg3895 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2001-03-19 20:43
Logged In: YES 
user_id=31392

Fixed in rev. 2.187 of compile.c
History
Date User Action Args
2022-04-10 16:03:52adminsetgithub: 34167
2001-03-16 22:01:48complexcreate