Commit 5121e7de authored by Jeremy Hylton's avatar Jeremy Hylton

Fix for SF bug [ #443866 ] Evaluating func_code causing core dump

Add test that calls eval with a code object that has free variables.
parent 15c1c4f6
......@@ -19,3 +19,4 @@ test_scope
18. verify that locals() works
19. var is bound and free in class
20. interaction with trace function
20. eval with free variables
......@@ -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"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment