[pypy-svn] r17392 - pypy/dist/pypy/interpreter/astcompiler

arigo at codespeak.net arigo at codespeak.net
Thu Sep 8 21:21:18 CEST 2005


Author: arigo
Date: Thu Sep  8 21:21:17 2005
New Revision: 17392

Modified:
   pypy/dist/pypy/interpreter/astcompiler/pycodegen.py
   pypy/dist/pypy/interpreter/astcompiler/symbols.py
Log:
Bug left by checking "... is not None" on a flag whose value is now 0/1
instead of the (insane) original None/1.

Using False/True looks like a good move anyway.



Modified: pypy/dist/pypy/interpreter/astcompiler/pycodegen.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/pycodegen.py	(original)
+++ pypy/dist/pypy/interpreter/astcompiler/pycodegen.py	Thu Sep  8 21:21:17 2005
@@ -1251,7 +1251,7 @@
         AbstractFunctionCode.__init__(self, space, func, scopes, isLambda, class_name, mod)
         self.graph.setFreeVars(self.scope.get_free_vars())
         self.graph.setCellVars(self.scope.get_cell_vars())
-        if self.scope.generator is not None:
+        if self.scope.generator:
             self.graph.setFlag(CO_GENERATOR)
 
 class GenExprCodeGenerator(AbstractFunctionCode):

Modified: pypy/dist/pypy/interpreter/astcompiler/symbols.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/symbols.py	(original)
+++ pypy/dist/pypy/interpreter/astcompiler/symbols.py	Thu Sep  8 21:21:17 2005
@@ -27,7 +27,7 @@
         # nested is true if the class could contain free variables,
         # i.e. if it is nested within another function.
         self.nested = 0
-        self.generator = 0
+        self.generator = False
         self.klass = None
         if klass is not None:
             for i in range(len(klass)):
@@ -456,7 +456,7 @@
 
     def visitYield(self, node ):
         scope = self.cur_scope()
-        scope.generator = 1
+        scope.generator = True
         node.value.accept( self )
 
 def sort(l):



More information about the Pypy-commit mailing list