Fix deprecation warning regarding NotImplemented being evaluated in boolean context.

This commit is contained in:
Karthikeyan Singaravelan 2020-07-29 13:35:33 +00:00
parent 4b06e0a5a1
commit 1e1bce5c38

View File

@ -74,7 +74,10 @@ class ErrorDetail(str):
def __eq__(self, other):
r = super().__eq__(other)
try:
if r is not NotImplemented:
return r and self.code == other.code
else:
return self.code == other.code
except AttributeError:
return r