Skip to content

Fix deprecation warning regarding NotImplemented being evaluated in boolean context. #7435

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

Closed
wants to merge 2 commits into from

Conversation

tirkarthi
Copy link
Contributor

Description

Check for NotImplemented being evaluated in boolean context. Fixes #7433 .

Copy link
Member

@rpkilby rpkilby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tirkarthi. Thanks for submitting this, however based on https://code.djangoproject.com/ticket/30651, I believe we should pass through the NotImplemented result. something like:

if r is NotImplemented:
    return r
try:
    return r and self.code == other.code
except AttributeError
    return r

@tirkarthi
Copy link
Contributor Author

Thanks @rpkilby. This was an issue in CPython itself where some cases have to be fixed https://bugs.python.org/issue37685

@rpkilby rpkilby self-requested a review August 6, 2020 16:50
@adamchainz
Copy link
Contributor

This has been fixed by #7531 with the proposed change.

@adamchainz adamchainz closed this Oct 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test_empty_not_allowed_if_allow_empty_is_set_to_false emits deprecation warning in Python 3.9
4 participants