summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_scope.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_scope.py')
-rw-r--r--Lib/test/test_scope.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py
index cb06036..58dd637 100644
--- a/Lib/test/test_scope.py
+++ b/Lib/test/test_scope.py
@@ -465,3 +465,16 @@ class TestClass:
sys.settrace(tracer)
adaptgetter("foo", TestClass, (1, ""))
sys.settrace(None)
+
+print "20. eval with free variables"
+
+def f(x):
+ return lambda: x + 1
+
+g = f(3)
+try:
+ eval(g.func_code)
+except TypeError:
+ pass
+else:
+ print "eval() should have failed, because code contained free vars"