Patch #1550800: make exec a function.
diff --git a/Lib/test/test_class.py b/Lib/test/test_class.py
index 795acd9..f33462a 100644
--- a/Lib/test/test_class.py
+++ b/Lib/test/test_class.py
@@ -136,7 +136,7 @@
 
 d = {}
 for method in testmeths:
-    exec method_template % locals() in d
+    exec(method_template % locals(), d)
 for k in d:
     setattr(AllTests, k, d[k])
 del d, k
@@ -291,7 +291,7 @@
     """Raise TestFailed if executing 'stmt' does not raise 'exception'
     """
     try:
-        exec stmt
+        exec(stmt)
     except exception:
         pass
     else: