summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-02-27 20:23:58 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-02-27 20:23:58 (GMT)
commit5941d191deaf2a0c8eab5ce75316067ed16dfb1a (patch)
tree39d09bee826ff8769a783edb8481a1425191a155 /Lib
parentbd00cdaf733d2981540de80e9ccf5e3b19b482d5 (diff)
downloadcpython-5941d191deaf2a0c8eab5ce75316067ed16dfb1a.zip
cpython-5941d191deaf2a0c8eab5ce75316067ed16dfb1a.tar.gz
cpython-5941d191deaf2a0c8eab5ce75316067ed16dfb1a.tar.bz2
add from __future__ import nested_scopes to strings passed to compile
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_scope.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py
index d64cead..b4c492a 100644
--- a/Lib/test/test_scope.py
+++ b/Lib/test/test_scope.py
@@ -179,21 +179,24 @@ verify(f(6) == 720)
print "11. unoptimized namespaces"
-check_syntax("""def unoptimized_clash1(strip):
+check_syntax("""from __future__ import nested_scopes
+def unoptimized_clash1(strip):
def f(s):
from string import *
return strip(s) # ambiguity: free or local
return f
""")
-check_syntax("""def unoptimized_clash2():
+check_syntax("""from __future__ import nested_scopes
+def unoptimized_clash2():
from string import *
def f(s):
return strip(s) # ambiguity: global or local
return f
""")
-check_syntax("""def unoptimized_clash2():
+check_syntax("""from __future__ import nested_scopes
+def unoptimized_clash2():
from string import *
def g():
def f(s):
@@ -202,20 +205,23 @@ check_syntax("""def unoptimized_clash2():
""")
# XXX could allow this for exec with const argument, but what's the point
-check_syntax("""def error(y):
+check_syntax("""from __future__ import nested_scopes
+def error(y):
exec "a = 1"
def f(x):
return x + y
return f
""")
-check_syntax("""def f(x):
+check_syntax("""from __future__ import nested_scopes
+def f(x):
def g():
return x
del x # can't del name
""")
-check_syntax("""def f():
+check_syntax("""from __future__ import nested_scopes
+def f():
def g():
from string import *
return strip # global or local?