diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-07-30 21:55:29 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-07-30 21:55:29 (GMT) |
commit | 5121e7de11eaf8ef872aef4b0c58612d6a814161 (patch) | |
tree | d2abf5d8198ae14feea34850d9489ea87600345b /Lib/test/test_scope.py | |
parent | 15c1c4f6d2cc9c657ae1cb3fc50b14d7e8063343 (diff) | |
download | cpython-5121e7de11eaf8ef872aef4b0c58612d6a814161.zip cpython-5121e7de11eaf8ef872aef4b0c58612d6a814161.tar.gz cpython-5121e7de11eaf8ef872aef4b0c58612d6a814161.tar.bz2 |
Fix for SF bug [ #443866 ] Evaluating func_code causing core dump
Add test that calls eval with a code object that has free variables.
Diffstat (limited to 'Lib/test/test_scope.py')
-rw-r--r-- | Lib/test/test_scope.py | 13 |
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" |