[pypy-svn] r32045 - in pypy/dist/pypy: annotation rpython

fijal at codespeak.net fijal at codespeak.net
Thu Sep 7 12:34:16 CEST 2006


Author: fijal
Date: Thu Sep  7 12:34:00 2006
New Revision: 32045

Modified:
   pypy/dist/pypy/annotation/listdef.py
   pypy/dist/pypy/rpython/rlist.py
Log:
Changed *is* operator on list annotations to equality of elements definition. If this stuff breaks anything, please just revert it.


Modified: pypy/dist/pypy/annotation/listdef.py
==============================================================================
--- pypy/dist/pypy/annotation/listdef.py	(original)
+++ pypy/dist/pypy/annotation/listdef.py	Thu Sep  7 12:34:00 2006
@@ -109,6 +109,15 @@
             for position_key in self.read_locations:
                 self.bookkeeper.annotator.reflowfromposition(position_key)
         return updated
+    
+    def __eq__(self, other):
+        return self.s_value is other.s_value or self.s_value == other.s_value
+    
+    def __ne__(self, other):
+        return self.s_value is not other.s_value and self.s_value != other.s_value
+    
+    def __hash__(self):
+        return hash(self.s_value)
 
 
 class ListDef:
@@ -138,7 +147,7 @@
         return self.listitem.s_value
 
     def same_as(self, other):
-        return self.listitem is other.listitem
+        return self.listitem == other.listitem
 
     def union(self, other):
         if (self.same_as(MOST_GENERAL_LISTDEF) or

Modified: pypy/dist/pypy/rpython/rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/rlist.py	(original)
+++ pypy/dist/pypy/rpython/rlist.py	Thu Sep  7 12:34:00 2006
@@ -242,7 +242,7 @@
     def convert_from_to((r_lst1, r_lst2), v, llops):
         if r_lst1.listitem is None or r_lst2.listitem is None:
             return NotImplemented
-        if r_lst1.listitem is not r_lst2.listitem:
+        if r_lst1.listitem != r_lst2.listitem:
             return NotImplemented
         return v
 



More information about the Pypy-commit mailing list