[pypy-svn] r9606 - pypy/dist/pypy/annotation

pedronis at codespeak.net pedronis at codespeak.net
Thu Mar 3 17:10:58 CET 2005


Author: pedronis
Date: Thu Mar  3 17:10:57 2005
New Revision: 9606

Modified:
   pypy/dist/pypy/annotation/classdef.py
   pypy/dist/pypy/annotation/unaryop.py
Log:
don't block the setattr block if we did not increment the rev number, we may never get there again in that case.



Modified: pypy/dist/pypy/annotation/classdef.py
==============================================================================
--- pypy/dist/pypy/annotation/classdef.py	(original)
+++ pypy/dist/pypy/annotation/classdef.py	Thu Mar  3 17:10:57 2005
@@ -170,19 +170,22 @@
         # reflow from all factories
         for position in self.getallinstantiations():
             self.bookkeeper.annotator.reflowfromposition(position)
+        return bump
 
     def generalize_attr(self, attr, s_value=None):
         # if the attribute exists in a superclass, generalize there.
         found = 0
+        r = False
         for clsdef in self.getmro():
             if attr in clsdef.attrs:
                 if found == 0:
-                    clsdef._generalize_attr(attr, s_value)
+                    r = clsdef._generalize_attr(attr, s_value)
                 found += 1
         if found == 0:
-            self._generalize_attr(attr, s_value)
+            return self._generalize_attr(attr, s_value)
         else:
             assert found == 1, "generalization itself should prevent this"
+        return r
 
     def about_attribute(self, name):
         for cdef in self.getmro():

Modified: pypy/dist/pypy/annotation/unaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/unaryop.py	(original)
+++ pypy/dist/pypy/annotation/unaryop.py	Thu Mar  3 17:10:57 2005
@@ -196,8 +196,8 @@
                 return
 
             # create or update the attribute in clsdef
-            clsdef.generalize_attr(attr, s_value)
-            raise BlockedInference
+            if clsdef.generalize_attr(attr, s_value): # block only if we bumped a rev number
+                raise BlockedInference
         return
 
     #def contains(self, other):



More information about the Pypy-commit mailing list