diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2003-05-21 17:34:50 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2003-05-21 17:34:50 (GMT) |
commit | 4d508adae3101434ae62be1c140e9877673dc257 (patch) | |
tree | b22ceb18bf19afd824be2fda26b89bd7079dca07 /Lib/test | |
parent | 6624e6854694315c25981f6bb6cfd360798169c5 (diff) | |
download | cpython-4d508adae3101434ae62be1c140e9877673dc257.zip cpython-4d508adae3101434ae62be1c140e9877673dc257.tar.gz cpython-4d508adae3101434ae62be1c140e9877673dc257.tar.bz2 |
Fix for SF [ 734869 ] Lambda functions in list comprehensions
The compiler was reseting the list comprehension tmpname counter for each function, but the symtable was using the same counter for the entire module. Repair by move tmpname into the symtable entry.
Bugfix candidate.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/output/test_grammar | 1 | ||||
-rw-r--r-- | Lib/test/test_grammar.py | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/output/test_grammar b/Lib/test/output/test_grammar index 6cf5862..00fab49 100644 --- a/Lib/test/output/test_grammar +++ b/Lib/test/output/test_grammar @@ -60,6 +60,7 @@ classdef [3, 4, 5] [(1, 'Apple'), (1, 'Banana'), (1, 'Coconut'), (2, 'Apple'), (2, 'Banana'), (2, 'Coconut'), (3, 'Apple'), (3, 'Banana'), (3, 'Coconut'), (4, 'Apple'), (4, 'Banana'), (4, 'Coconut'), (5, 'Apple'), (5, 'Banana'), (5, 'Coconut')] [(1, 'Banana'), (1, 'Coconut'), (2, 'Banana'), (2, 'Coconut'), (3, 'Banana'), (3, 'Coconut'), (4, 'Banana'), (4, 'Coconut'), (5, 'Banana'), (5, 'Coconut')] +[[1], [1, 1], [1, 2, 4], [1, 3, 9, 27], [1, 4, 16, 64, 256]] [False, False, False] [[1, 2], [3, 4], [5, 6]] [('Boeing', 'Airliner'), ('Boeing', 'Engine'), ('Ford', 'Engine'), ('Macdonalds', 'Cheeseburger')] diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index ea0a88c..cb77727 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -701,6 +701,7 @@ print [3 * x for x in nums] print [x for x in nums if x > 2] print [(i, s) for i in nums for s in strs] print [(i, s) for i in nums for s in [f for f in strs if "n" in f]] +print [(lambda a:[a**i for i in range(a+1)])(j) for j in range(5)] def test_in_func(l): return [None < x < 3 for x in l if x > 2] |