Skip to content

Commit b98d78a

Browse files
committed
add a test for locals() in exec and eval
1 parent 7879c95 commit b98d78a

File tree

1 file changed

+11
-0
lines changed
  • graalpython/com.oracle.graal.python.test/src/tests

1 file changed

+11
-0
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_exec.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,3 +266,14 @@ def test_issue3297(self):
266266
assert d['a'] == d['b']
267267
assert len(d['a']) == len(d['b'])
268268
assert d['a'] == d['b']
269+
270+
def test_locals_call(self):
271+
l = locals()
272+
exec("""if 1:
273+
assert locals() is l
274+
def f(a):
275+
exec('a=3')
276+
return a
277+
x = f(4)\n""")
278+
assert eval("locals() is l")
279+
assert l["x"] == 4

0 commit comments

Comments
 (0)