[pypy-svn] r66263 - pypy/branch/parser-compiler/pypy/interpreter/astcompiler

benjamin at codespeak.net benjamin at codespeak.net
Thu Jul 16 00:21:15 CEST 2009


Author: benjamin
Date: Thu Jul 16 00:21:14 2009
New Revision: 66263

Modified:
   pypy/branch/parser-compiler/pypy/interpreter/astcompiler/symtable.py
Log:
having an exec at all unoptimizes the scope

Modified: pypy/branch/parser-compiler/pypy/interpreter/astcompiler/symtable.py
==============================================================================
--- pypy/branch/parser-compiler/pypy/interpreter/astcompiler/symtable.py	(original)
+++ pypy/branch/parser-compiler/pypy/interpreter/astcompiler/symtable.py	Thu Jul 16 00:21:14 2009
@@ -34,6 +34,7 @@
         self.varnames = []
         self.children = []
         self.free_vars = []
+        self.has_exec = False
         self.has_free = False
         self.child_has_free = False
         self.nested = False
@@ -68,7 +69,7 @@
                           ret.col_offset)
 
     def note_exec(self, exc):
-        pass
+        self.has_exec = True
 
     def note_import_star(self, imp):
         pass
@@ -198,7 +199,7 @@
         self.return_with_value = True
 
     def note_exec(self, exc):
-        self.has_exec = True
+        Scope.note_exec(self, exc)
         if not exc.globals:
             self.optimized = False
             self.bare_exec = exc
@@ -249,6 +250,7 @@
                 trailer = "is a nested function"
             raise SyntaxError(err % (self.name, trailer), node.lineno,
                               node.col_offset)
+        self.optimized = self.optimized and not self.has_exec
 
 
 class ClassScope(Scope):



More information about the Pypy-commit mailing list