Skip to content

Fix #5557: Don't emit comparison-with-callable if the callable raises #5563

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

Merged
merged 6 commits into from
Dec 21, 2021

Conversation

jacobtylerwalls
Copy link
Member

Type of Changes

Type
🐛 Bug fix

Description

Typing constants such as typing.Any raise when called, which means they should not emit comparison-with-callable.

This PR skips emitting that message when a callable raises in its body (or if it's a typing constant, since some typing constants only raise via their decorator, not via their body).

Closes #5557

@Pierre-Sassoulas Pierre-Sassoulas added typing False Positive 🦟 A message is emitted but nothing is wrong with the code labels Dec 20, 2021
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.13.0 milestone Dec 20, 2021
@coveralls
Copy link

coveralls commented Dec 20, 2021

Pull Request Test Coverage Report for Build 1606974330

  • 6 of 6 (100.0%) changed or added relevant lines in 1 file are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.003%) to 93.693%

Files with Coverage Reduction New Missed Lines %
pylint/testutils/get_test_info.py 3 88.0%
Totals Coverage Status
Change from base Build 1603996110: 0.003%
Covered Lines: 14306
Relevant Lines: 15269

💛 - Coveralls

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

LGTM !

@Pierre-Sassoulas
Copy link
Member

The issue with the pipeline was due to #5561, it's reverted now, you should rebase to fix the primers :)

…lable raises

Typing constants such as `typing.Any` raise when called.
Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

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

Good job finding the special case for Optional. Small changes but looks good!

@Pierre-Sassoulas Pierre-Sassoulas merged commit 2a69387 into pylint-dev:main Dec 21, 2021
@jacobtylerwalls jacobtylerwalls deleted the raise-when-called branch December 21, 2021 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code typing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False positive comparison-with-callable when comparing to Any in python 3.10
4 participants