[pypy-svn] r10595 - pypy/dist/pypy/translator

pedronis at codespeak.net pedronis at codespeak.net
Wed Apr 13 21:58:29 CEST 2005


Author: pedronis
Date: Wed Apr 13 21:58:29 2005
New Revision: 10595

Modified:
   pypy/dist/pypy/translator/annrpython.py
Log:
don't let propagated SomeImpossibleValue enter operations,
see comment



Modified: pypy/dist/pypy/translator/annrpython.py
==============================================================================
--- pypy/dist/pypy/translator/annrpython.py	(original)
+++ pypy/dist/pypy/translator/annrpython.py	Wed Apr 13 21:58:29 2005
@@ -431,6 +431,17 @@
         argcells = [self.binding(a) for a in op.args]
         consider_meth = getattr(self,'consider_op_'+op.opname,
                                 self.default_consider_op)
+        # because benign SomeImpossibleValues are meant to propagate without leaving
+        # dangling blocked blocks around, and because of the None case below,
+        # let's be careful about avoiding propagated SomeImpossibleValues
+        # to enter an op; the latter can result in violations of the
+        # more general results invariant: e.g. if SomeImpossibleValue enters is_
+        #  is_(SomeImpossibleValue, None) -> SomeBool
+        #  is_(SomeInstance(not None), None) -> SomeBool(const=False) ...
+        # boom
+        for arg in argcells:
+            if isinstance(arg, annmodel.SomeImpossibleValue):
+                raise BlockedInference(info=op)
         resultcell = consider_meth(*argcells)
         if resultcell is None:
             resultcell = annmodel.SomeImpossibleValue()  # no return value



More information about the Pypy-commit mailing list