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

Suppress unsubscriptable-object warnings in type-checking blocks #5720

Merged
merged 4 commits into from Apr 9, 2022

Conversation

Pierre-Sassoulas
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas commented Jan 25, 2022

Type of Changes

Type
βœ“ πŸ› Bug fix

Description

Fixes #3979. Statements under if TYPE_CHECKING are not evaluated at runtime. That's why you can subscript otherwise unsubscriptable objects!

@Pierre-Sassoulas Pierre-Sassoulas added Bug πŸͺ² Regression False Positive 🦟 A message is emitted but nothing is wrong with the code labels Jan 25, 2022
@Pierre-Sassoulas Pierre-Sassoulas linked an issue Jan 25, 2022 that may be closed by this pull request
@jacobtylerwalls jacobtylerwalls added this to the 2.14.0 milestone Apr 9, 2022
@jacobtylerwalls jacobtylerwalls changed the title Add a regression test for issue #3979 and fix it Suppress unsubscriptable-object warnings in type-checking blocks Apr 9, 2022
@coveralls
Copy link

coveralls commented Apr 9, 2022

Pull Request Test Coverage Report for Build 2141248550

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.895%

Totals Coverage Status
Change from base Build 2141000809: 0.0%
Covered Lines: 15888
Relevant Lines: 16921

πŸ’› - Coveralls

Copy link
Member Author

@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.

Can't approve a MR I myself opened but thank you @jacobtylerwalls, LGTM.

Copy link
Member

@jacobtylerwalls jacobtylerwalls left a comment

Choose a reason for hiding this comment

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

βœ…

@Pierre-Sassoulas Pierre-Sassoulas merged commit 620347a into main Apr 9, 2022
@Pierre-Sassoulas Pierre-Sassoulas deleted the unsuscriptable-object-regression branch April 9, 2022 17:27
@jacobtylerwalls
Copy link
Member

@Pierre-Sassoulas I suppose this is a backport candidate to 2.13, if we're willing to fiddle with the changelogs. It's not critical.

@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 2.14.0, 2.13.8 May 1, 2022
@Pierre-Sassoulas Pierre-Sassoulas added the Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer label May 1, 2022
Pierre-Sassoulas added a commit that referenced this pull request May 2, 2022
…5720)

* Add a regression test for issue #3979

* Don't emit `unsubscriptable-object` for statements in type-checking blocks

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Pierre-Sassoulas added a commit that referenced this pull request May 2, 2022
…5720)

* Add a regression test for issue #3979

* Don't emit `unsubscriptable-object` for statements in type-checking blocks

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
@DanielNoord DanielNoord added Backported and removed Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer labels Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported Bug πŸͺ² False Positive 🦟 A message is emitted but nothing is wrong with the code Regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

E1136: False positive when used with typing (mypy) patterns
4 participants