Fix Task.__eq__() and __ne__() to explicitly compare the results
authorZac Medico <zmedico@gentoo.org>
Mon, 27 Sep 2010 21:13:30 +0000 (14:13 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 27 Sep 2010 21:13:30 +0000 (14:13 -0700)
from _get_hash_key().

pym/_emerge/Task.py

index 31788b57695df480e22d7754ea2ff80e8af1f156..dfb560f6ad332e6cfb63af0a56be777623748756 100644 (file)
@@ -12,10 +12,14 @@ class Task(SlotObject):
                        raise NotImplementedError(self)
 
        def __eq__(self, other):
-               return self._get_hash_key() == other
+               if self.__class__ is not other.__class__:
+                       return False
+               return self._get_hash_key() == other._get_hash_key()
 
        def __ne__(self, other):
-               return self._get_hash_key() != other
+               if self.__class__ is not other.__class__:
+                       return True
+               return self._get_hash_key() != other._get_hash_key()
 
        def __hash__(self):
                hash_value = getattr(self, "_hash_value", None)