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

[Python 3.9 compat] Check for __class_getitem__ #3951

Closed
JulienPalard opened this issue Nov 22, 2020 · 3 comments
Closed

[Python 3.9 compat] Check for __class_getitem__ #3951

JulienPalard opened this issue Nov 22, 2020 · 3 comments
Labels
Blocker 🙅 Blocks the next release Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code python 3.9

Comments

@JulienPalard
Copy link
Contributor

Python 3.9 starts to make a great use of __class_getitem__ for exemple in collections.deque.

pylint/checkers/typecheck.py should probably look for it to infer if something is subscriptable.

Reproducer:

import collections
print(collections.deque[int])

which give:

test.py:11:6: E1136: Value 'collections.deque' is unsubscriptable (unsubscriptable-object)

while the code works thanks to the __class_getitem__.

Related to #3890.
See also #3882.

@hippo91
Copy link
Contributor

hippo91 commented Nov 26, 2020

👍

@hippo91 hippo91 added Blocker 🙅 Blocks the next release Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code python 3.9 labels Nov 26, 2020
@cdce8p
Copy link
Member

cdce8p commented Feb 3, 2021

This seems to be fixed with: pylint-dev/astroid#885
So non blocker after an astroid update 🎉

@hippo91
Copy link
Contributor

hippo91 commented Feb 6, 2021

@cdce8p 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocker 🙅 Blocks the next release Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code python 3.9
Projects
None yet
Development

No branches or pull requests

3 participants