Issue #21591: add test for qualified exec in tuple form.

This commit is contained in:
Robert Jordens 2014-07-29 17:24:24 +02:00
parent 9b1d670361
commit af09c774e5
2 changed files with 17 additions and 0 deletions

View File

@ -90,6 +90,22 @@ class TestSpecifics(unittest.TestCase):
with self.assertRaises(TypeError): with self.assertRaises(TypeError):
exec("a = b + 1", g, l) in g, l exec("a = b + 1", g, l) in g, l
def test_nested_qualified_exec(self):
# Can use qualified exec in nested functions.
code = ["""
def g():
def f():
if True:
exec "" in {}, {}
""", """
def g():
def f():
if True:
exec("", {}, {})
"""]
for c in code:
compile(c, "<code>", "exec")
def test_exec_with_general_mapping_for_locals(self): def test_exec_with_general_mapping_for_locals(self):
class M: class M:

View File

@ -648,6 +648,7 @@ Richard Jones
Irmen de Jong Irmen de Jong
Lucas de Jonge Lucas de Jonge
Kristján Valur Jónsson Kristján Valur Jónsson
Robert Jordens
Jens B. Jorgensen Jens B. Jorgensen
John Jorgensen John Jorgensen
Sijin Joseph Sijin Joseph