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

False positive unsubscriptable-object #2307

Merged

Conversation

mbyrnepr2
Copy link
Member

@mbyrnepr2 mbyrnepr2 commented Sep 25, 2023

Type of Changes

Type
βœ“ πŸ› Bug fix
✨ New feature
βœ“ πŸ”¨ Refactoring
πŸ“œ Docs

Description

  • Fix a false positive for unsubscriptable-object (regression in 2.15.7).
  • Refactor to raise an InferenceError if the TypeVar naming is invalid.

Closes #2305

@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.15.8 milestone Sep 25, 2023
@mbyrnepr2 mbyrnepr2 marked this pull request as ready for review September 25, 2023 18:51
@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

Merging #2307 (43a459b) into main (74b5a7a) will increase coverage by 0.00%.
Report is 2 commits behind head on main.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2307   +/-   ##
=======================================
  Coverage   92.85%   92.85%           
=======================================
  Files          94       94           
  Lines       11053    11056    +3     
=======================================
+ Hits        10263    10266    +3     
  Misses        790      790           
Flag Coverage Ξ”
linux 92.66% <100.00%> (+<0.01%) ⬆️
pypy 91.00% <100.00%> (+<0.01%) ⬆️
windows 92.44% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Ξ”
astroid/brain/brain_typing.py 87.01% <100.00%> (+0.25%) ⬆️

@mbyrnepr2
Copy link
Member Author

I'm thinking of adding the test examples from this issue and pylint-dev/pylint#9069 to the Pylint functional tests.

Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
@mbyrnepr2
Copy link
Member Author

Tests: pylint-dev/pylint#9071

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.

Thanks for the quick work!

@jacobtylerwalls jacobtylerwalls merged commit 1f0f2f8 into pylint-dev:main Sep 26, 2023
20 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 26, 2023
Fix a regression in 2.15.7 for ``unsubscriptable-object``.

Raise an `InferenceError` when there is a `SyntaxError` due to an invalid `TypeVar` name.
This reverts commit 89dfb48.

Closes #2305
Closes pylint-dev/pylint#9069

(cherry picked from commit 1f0f2f8)
@mbyrnepr2 mbyrnepr2 deleted the 2305_unsubscriptable_object branch September 26, 2023 12:08
jacobtylerwalls pushed a commit that referenced this pull request Sep 26, 2023
Fix a regression in 2.15.7 for ``unsubscriptable-object``.

Raise an `InferenceError` when there is a `SyntaxError` due to an invalid `TypeVar` name.
This reverts commit 89dfb48.

Closes #2305
Closes pylint-dev/pylint#9069

(cherry picked from commit 1f0f2f8)

Co-authored-by: Mark Byrne <31762852+mbyrnepr2@users.noreply.github.com>
@Pierre-Sassoulas Pierre-Sassoulas added backported Assigned once the backport is done and removed backport maintenance/2.15.x labels Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported Assigned once the backport is done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in Astroid version 2.15.7 in handling subscriptable type parameters
3 participants