summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRobert Jordens <jordens@gmail.com>2014-07-29 15:24:24 (GMT)
committerRobert Jordens <jordens@gmail.com>2014-07-29 15:24:24 (GMT)
commitaf09c774e57d9c9b265fad0c092b63852d06ed25 (patch)
treed1ec26a66aa5a35d0f4bb15792f77099d05b0648 /Lib
parent9b1d670361215f8d56de7a05cb1d430009735fd5 (diff)
downloadcpython-af09c774e57d9c9b265fad0c092b63852d06ed25.zip
cpython-af09c774e57d9c9b265fad0c092b63852d06ed25.tar.gz
cpython-af09c774e57d9c9b265fad0c092b63852d06ed25.tar.bz2
Issue #21591: add test for qualified exec in tuple form.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_compile.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index ec2709d..5f91d0d 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, "<code>", "exec")
+
def test_exec_with_general_mapping_for_locals(self):
class M: