Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 954aed8

Browse files
committed
Add test for eval() w/ free variables.
Related to SF bug #505315
1 parent 24ea8d3 commit 954aed8

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

Lib/test/output/test_scope

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ test_scope
2121
20. interaction with trace function
2222
20. eval and exec with free variables
2323
21. list comprehension with local variables
24+
22. eval with free variables

Lib/test/test_scope.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,3 +512,13 @@ def x():
512512
print bad
513513
except NameError:
514514
pass
515+
516+
print "22. eval with free variables"
517+
518+
def f(x):
519+
def g():
520+
x
521+
eval("x + 1")
522+
return g
523+
524+
f(4)()

0 commit comments

Comments
 (0)