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

pedronis at codespeak.net pedronis at codespeak.net
Sat Jun 18 01:13:55 CEST 2005


Author: pedronis
Date: Sat Jun 18 01:13:54 2005
New Revision: 13569

Modified:
   pypy/dist/pypy/annotation/model.py
Log:
oops, equality of SomeLists and SomeDicts was ignoring .const etc, this meant contains succeeding when they should have not
and missed reflowing



Modified: pypy/dist/pypy/annotation/model.py
==============================================================================
--- pypy/dist/pypy/annotation/model.py	(original)
+++ pypy/dist/pypy/annotation/model.py	Sat Jun 18 01:13:54 2005
@@ -204,8 +204,15 @@
     def __init__(self, listdef):
         self.listdef = listdef
     def __eq__(self, other):
-        return (self.__class__ is other.__class__ and
-                self.listdef.same_as(other.listdef))
+        if self.__class__ is not other.__class__:
+            return False
+        if not self.listdef.same_as(other.listdef):
+            return False
+        selfdic = self.__dict__.copy()
+        otherdic = self.__dict__.copy()
+        del selfdic['listdef']
+        del otherdic['listdef']
+        return selfdic == otherdic
 
     def can_be_none(self):
         return True
@@ -240,8 +247,15 @@
     def __init__(self, dictdef):
         self.dictdef = dictdef
     def __eq__(self, other):
-        return (self.__class__ is other.__class__ and
-                self.dictdef.same_as(other.dictdef))
+        if self.__class__ is not other.__class__:
+            return False
+        if not self.dictdef.same_as(other.dictdef):
+            return False
+        selfdic = self.__dict__.copy()
+        otherdic = self.__dict__.copy()
+        del selfdic['dictdef']
+        del otherdic['dictdef']
+        return selfdic == otherdic
 
     def can_be_none(self):
         return False



More information about the Pypy-commit mailing list