Skip to content
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

Prevent applying boolean ops to NotImplemented #1702

Merged
merged 2 commits into from
Jul 10, 2022

Conversation

jacobtylerwalls
Copy link
Member

@jacobtylerwalls jacobtylerwalls commented Jul 10, 2022

Steps

  • For new features or bug fixes, add a ChangeLog entry describing what your PR does.
  • Write a good description on what the PR does.

Description

Prevents this DeprecationWarning:

DeprecationWarning: NotImplemented should not be used in a boolean context

Reproducer:
python -Werror -m pylint ipaddress

Type of Changes

Type
🐛 Bug fix

@jacobtylerwalls jacobtylerwalls added the Maintenance Discussion or action around maintaining astroid or the dev workflow label Jul 10, 2022
@coveralls
Copy link

coveralls commented Jul 10, 2022

Pull Request Test Coverage Report for Build 2645011504

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.002%) to 92.188%

Totals Coverage Status
Change from base Build 2644754130: 0.002%
Covered Lines: 9500
Relevant Lines: 10305

💛 - Coveralls

@@ -1117,6 +1117,12 @@ def __radd__(self, other): return NotImplemented
first = next(ast_node.infer())
self.assertEqual(first, util.Uninferable)

@pytest.mark.filterwarnings("error::DeprecationWarning")
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to filter that ? I thought the fix was precisely to remove the deprecation warning ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good Q, "filter" is a little misleading here. It's taking DeprecationWarning and raising it to error. Revert the fix and this test will fail.

Copy link
Member Author

Choose a reason for hiding this comment

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

Otherwise the test would pass anyway, since pytest doesn't fail tests when there are deprecationwarnings.

Copy link
Member

Choose a reason for hiding this comment

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

We might as well change the global configuration, we often have to so "fix deprecation warning" merge request both for astroid and pylint.

@jacobtylerwalls jacobtylerwalls merged commit 3dfbcb5 into pylint-dev:main Jul 10, 2022
@jacobtylerwalls jacobtylerwalls deleted the bool-not-implemented branch July 10, 2022 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance Discussion or action around maintaining astroid or the dev workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants