-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_empty_not_allowed_if_allow_empty_is_set_to_false emits deprecation warning in Python 3.9 #7433
Comments
Believe this to be closed via #7531 |
I'm getting a similar error from
So does the fix applied to |
Seems valid to me. Looks like we need to change from this… def __ne__(self, other):
return not self.__eq__(other) to this… def __ne__(self, other):
r = self.__eq__(other)
if r is NotImplemented:
return NotImplemented
return not r Would you be interested in submitting a pull request for this change? |
@tomchristie sure, see #8538. I'm not sure how best to add a test to cover that case but I'd be happy to do so given some guidance. |
…#8538) PR #7531 resolved issue #7433 by updating `ErrorDetails.__eq__` to correctly handle the `NotImplemented` case. However, Python 3.9 continues to issue the following warning: DeprecationWarning: NotImplemented should not be used in a boolean context This is because `__ne__` still doesn't handle the `NotImplemented` case correctly. In order to avoid this warning, this commit makes the same change for `__ne__` as previously made for `__eq__`.
…encode#8538) PR encode#7531 resolved issue encode#7433 by updating `ErrorDetails.__eq__` to correctly handle the `NotImplemented` case. However, Python 3.9 continues to issue the following warning: DeprecationWarning: NotImplemented should not be used in a boolean context This is because `__ne__` still doesn't handle the `NotImplemented` case correctly. In order to avoid this warning, this commit makes the same change for `__ne__` as previously made for `__eq__`.
Checklist
master
branch of Django REST framework.Steps to reproduce
test_empty_not_allowed_if_allow_empty_is_set_to_false emits deprecation warning in Python 3.9 due to NotImplemented being used in boolean context which always evaluates to True
Expected behavior
Actual behavior
The text was updated successfully, but these errors were encountered: