Skip to content

False positive unsubscriptable-object#2307

Merged
jacobtylerwalls merged 5 commits into
pylint-dev:mainfrom
mbyrnepr2:2305_unsubscriptable_object
Sep 26, 2023
Merged

False positive unsubscriptable-object#2307
jacobtylerwalls merged 5 commits into
pylint-dev:mainfrom
mbyrnepr2:2305_unsubscriptable_object

Conversation

@mbyrnepr2

@mbyrnepr2 mbyrnepr2 commented Sep 25, 2023

Copy link
Copy Markdown
Member

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

codecov Bot commented Sep 25, 2023

Copy link
Copy Markdown

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
Copy Markdown
Member Author

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

Comment thread astroid/brain/brain_typing.py Outdated
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
@mbyrnepr2

Copy link
Copy Markdown
Member Author

Tests: pylint-dev/pylint#9071

Comment thread tests/brain/test_typing.py Outdated

@jacobtylerwalls jacobtylerwalls left a comment

Copy link
Copy Markdown
Member

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

Regression in Astroid version 2.15.7 in handling subscriptable type parameters

3 participants