Преглед на файлове

[>3.1] Result.__ne__ did not take NotImplemented into account

Ask Solem преди 9 години
родител
ревизия
91f1d4c87b
променени са 1 файла, в които са добавени 6 реда и са изтрити 3 реда
  1. 6 3
      celery/result.py

+ 6 - 3
celery/result.py

@@ -299,7 +299,8 @@ class AsyncResult(ResultBase):
         return NotImplemented
 
     def __ne__(self, other):
-        return not self.__eq__(other)
+        res = self.__eq__(other)
+        return True if res is NotImplemented else not res
 
     def __copy__(self):
         return self.__class__(
@@ -717,7 +718,8 @@ class ResultSet(ResultBase):
         return NotImplemented
 
     def __ne__(self, other):
-        return not self.__eq__(other)
+        res = self.__eq__(other)
+        return True if res is NotImplemented else not res
 
     def __repr__(self):
         return '<{0}: [{1}]>'.format(type(self).__name__,
@@ -802,7 +804,8 @@ class GroupResult(ResultSet):
         return NotImplemented
 
     def __ne__(self, other):
-        return not self.__eq__(other)
+        res = self.__eq__(other)
+        return True if res is NotImplemented else not res
 
     def __repr__(self):
         return '<{0}: {1} [{2}]>'.format(type(self).__name__, self.id,