summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_scope.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-10-18 16:23:11 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-10-18 16:23:11 (GMT)
commitcf672f15e0b31eaff58e54dbbe62a2d52d49a63c (patch)
treed6f092c7ac9c1c6ef70099e16ef87527ae49494d /Lib/test/test_scope.py
parent961dfe0d854ad28e3258d209210cc4053ebfb866 (diff)
downloadcpython-cf672f15e0b31eaff58e54dbbe62a2d52d49a63c.zip
cpython-cf672f15e0b31eaff58e54dbbe62a2d52d49a63c.tar.gz
cpython-cf672f15e0b31eaff58e54dbbe62a2d52d49a63c.tar.bz2
Add test for local assigned to only in a nested list comp
Diffstat (limited to 'Lib/test/test_scope.py')
-rw-r--r--Lib/test/test_scope.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py
index 1633b87..18dd0c7 100644
--- a/Lib/test/test_scope.py
+++ b/Lib/test/test_scope.py
@@ -485,3 +485,21 @@ else:
print "eval() should have failed, because code contained free vars"
warnings.resetwarnings()
+
+print "21. list comprehension with local variables"
+
+try:
+ print bad
+except NameError:
+ pass
+else:
+ print "bad should not be defined"
+
+def x():
+ [bad for s in 'a b' for bad in s.split()]
+
+x()
+try:
+ print bad
+except NameError:
+ pass