mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 09:36:49 +03:00
Return NotImplemented sooner for ErrorDetail equality test (#7531)
The test suite raises warnings when tested against Python 3.9 `DeprecationWarning: NotImplemented should not be used in a boolean context` Where `r` returns `NotImplemented` then this change returns `NotImplemented` first to avoid the comparison test.
This commit is contained in:
parent
79daf315c4
commit
79c37d0dc3
|
@ -73,6 +73,8 @@ class ErrorDetail(str):
|
|||
|
||||
def __eq__(self, other):
|
||||
r = super().__eq__(other)
|
||||
if r is NotImplemented:
|
||||
return NotImplemented
|
||||
try:
|
||||
return r and self.code == other.code
|
||||
except AttributeError:
|
||||
|
|
Loading…
Reference in New Issue
Block a user