diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index ec2709dbd1c..5f91d0d6387 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -90,6 +90,22 @@ class TestSpecifics(unittest.TestCase): with self.assertRaises(TypeError): 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, "", "exec") + def test_exec_with_general_mapping_for_locals(self): class M: diff --git a/Misc/ACKS b/Misc/ACKS index 7f105c70f6b..3751fd7a197 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -648,6 +648,7 @@ Richard Jones Irmen de Jong Lucas de Jonge Kristján Valur Jónsson +Robert Jordens Jens B. Jorgensen John Jorgensen Sijin Joseph