[Python-checkins] cpython (2.7): Issue #21591: add test for qualified exec in tuple form.

dirkjan.ochtman python-checkins at python.org
Tue Jul 29 17:26:01 CEST 2014


http://hg.python.org/cpython/rev/6c47c6d2033e
changeset:   91924:6c47c6d2033e
branch:      2.7
user:        Robert Jordens <jordens at gmail.com>
date:        Tue Jul 29 17:24:24 2014 +0200
summary:
  Issue #21591: add test for qualified exec in tuple form.

files:
  Lib/test/test_compile.py |  16 ++++++++++++++++
  Misc/ACKS                |   1 +
  2 files changed, 17 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -90,6 +90,22 @@
         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, "<code>", "exec")
+
     def test_exec_with_general_mapping_for_locals(self):
 
         class M:
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -648,6 +648,7 @@
 Irmen de Jong
 Lucas de Jonge
 Kristján Valur Jónsson
+Robert Jordens
 Jens B. Jorgensen
 John Jorgensen
 Sijin Joseph

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list