[pypy-svn] r17524 - in pypy/dist/pypy/interpreter: astcompiler test

ac at codespeak.net ac at codespeak.net
Tue Sep 13 13:39:42 CEST 2005


Author: ac
Date: Tue Sep 13 13:39:41 2005
New Revision: 17524

Modified:
   pypy/dist/pypy/interpreter/astcompiler/pycodegen.py
   pypy/dist/pypy/interpreter/test/test_compiler.py
Log:
Dissallow unqualified exec in a nested function.

Modified: pypy/dist/pypy/interpreter/astcompiler/pycodegen.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/pycodegen.py	(original)
+++ pypy/dist/pypy/interpreter/astcompiler/pycodegen.py	Tue Sep 13 13:39:41 2005
@@ -912,6 +912,8 @@
         }
 
     def visitExec(self, node):
+        if self.scope.nested and node.locals is None and node.globals is None:
+            raise SyntaxError('unqualified exec is not allowed in a nested function')
         node.expr.accept( self )
         if node.locals is None:
             self.emitop_obj('LOAD_CONST', self.space.w_None)

Modified: pypy/dist/pypy/interpreter/test/test_compiler.py
==============================================================================
--- pypy/dist/pypy/interpreter/test/test_compiler.py	(original)
+++ pypy/dist/pypy/interpreter/test/test_compiler.py	Tue Sep 13 13:39:41 2005
@@ -193,9 +193,6 @@
     def test_scope_unoptimized_clash1_b(self):
         py.test.skip("INPROGESS")
 
-    def test_scope_exec_in_nested(self):
-        py.test.skip("INPROGESS")
-
     def test_scope_importstar_in_nested(self):
         py.test.skip("INPROGESS")
 



More information about the Pypy-commit mailing list