[pypy-svn] rev 2210 - pypy/trunk/src/pypy/translator

arigo at codespeak.net arigo at codespeak.net
Tue Nov 18 00:04:36 CET 2003


Author: arigo
Date: Tue Nov 18 00:04:34 2003
New Revision: 2210

Modified:
   pypy/trunk/src/pypy/translator/annheap.py
   pypy/trunk/src/pypy/translator/annotation.py
Log:
Just in case, a few type-checking assertions.


Modified: pypy/trunk/src/pypy/translator/annheap.py
==============================================================================
--- pypy/trunk/src/pypy/translator/annheap.py	(original)
+++ pypy/trunk/src/pypy/translator/annheap.py	Tue Nov 18 00:04:34 2003
@@ -160,6 +160,7 @@
     def get_type(self, cell):
         """Get the type of 'cell', as specified by the annotations, or None."""
         # Returns None if cell is None.
+        assert isinstance(cell, XCell) or cell is None
         c = self.get('type', [cell])
         if isinstance(c, XConstant):
             return c.value

Modified: pypy/trunk/src/pypy/translator/annotation.py
==============================================================================
--- pypy/trunk/src/pypy/translator/annotation.py	(original)
+++ pypy/trunk/src/pypy/translator/annotation.py	Tue Nov 18 00:04:34 2003
@@ -17,6 +17,10 @@
         self.args   = list(args)  # list of XCells
         self.result = result      # an XCell
         self.forward_deps = []    # annotations that depend on this one
+        # catch bugs involving confusion between Variables/Constants
+        # and XCells/XConstants
+        for cell in args + [result]:
+            assert isinstance(cell, XCell)
 
     def __eq__(self, other):
         return (self.__class__ is other.__class__ and 


More information about the Pypy-commit mailing list