-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
unsubscriptable-object error reported for abstract generic types #2822
Comments
Thanks @aviv-ebates I can confirm the bug. |
I am having a similar issue, was this problem fixed for anyone? |
@santanaraphael This is still an issue, no one got to work on it just yet. |
Any update on this ? |
Having the same problem. |
+1 pylint 2.5.0, astroid 2.4.0, python 3.7.6 |
I think this doesn't have to do with abstract generic types. I can reproduce this error with just a metaclass: import typing
variable = typing.TypeVar("variable")
class A(typing.Generic[variable], metaclass=type):
pass
class B(A[variable]):
pass This might have to do with the fact that |
+1. Cheers. |
Includes some minor code changes to fix errors from static type checking. Disable unsubscriptable-object pylint check on Wrapper subclass declarations, as this hits the bug described in pylint-dev/pylint#2822. Signed-off-by: Chris PeBenito <[email protected]>
Not sure if this is related, but it also does not seem to accept the builtin value |
This issue will be fixed with the next release of pylint. |
What's New in astroid 2.5.3? ============================ Release Date: 2021-04-10 * Takes into account the fact that subscript inferring for a ClassDef may involve __class_getitem__ method * Reworks the `collections` and `typing` brain so that `pylint`s acceptance tests are fine. Closes pylint-dev/pylint#4206 * Use ``inference_tip`` for ``typing.TypedDict`` brain. * Fix mro for classes that inherit from typing.Generic * Add inference tip for typing.Generic and typing.Annotated with ``__class_getitem__`` Closes pylint-dev/pylint#2822 Signed-off-by: Zheng Ruoqin <[email protected]> Signed-off-by: Khem Raj <[email protected]>
What's New in astroid 2.5.3? ============================ Release Date: 2021-04-10 * Takes into account the fact that subscript inferring for a ClassDef may involve __class_getitem__ method * Reworks the `collections` and `typing` brain so that `pylint`s acceptance tests are fine. Closes pylint-dev/pylint#4206 * Use ``inference_tip`` for ``typing.TypedDict`` brain. * Fix mro for classes that inherit from typing.Generic * Add inference tip for typing.Generic and typing.Annotated with ``__class_getitem__`` Closes pylint-dev/pylint#2822 Signed-off-by: Zheng Ruoqin <[email protected]> Signed-off-by: Khem Raj <[email protected]>
What's New in astroid 2.5.3? ============================ Release Date: 2021-04-10 * Takes into account the fact that subscript inferring for a ClassDef may involve __class_getitem__ method * Reworks the `collections` and `typing` brain so that `pylint`s acceptance tests are fine. Closes pylint-dev/pylint#4206 * Use ``inference_tip`` for ``typing.TypedDict`` brain. * Fix mro for classes that inherit from typing.Generic * Add inference tip for typing.Generic and typing.Annotated with ``__class_getitem__`` Closes pylint-dev/pylint#2822 Signed-off-by: Zheng Ruoqin <[email protected]> Signed-off-by: Khem Raj <[email protected]>
What's New in astroid 2.5.3? ============================ Release Date: 2021-04-10 * Takes into account the fact that subscript inferring for a ClassDef may involve __class_getitem__ method * Reworks the `collections` and `typing` brain so that `pylint`s acceptance tests are fine. Closes pylint-dev/pylint#4206 * Use ``inference_tip`` for ``typing.TypedDict`` brain. * Fix mro for classes that inherit from typing.Generic * Add inference tip for typing.Generic and typing.Annotated with ``__class_getitem__`` Closes pylint-dev/pylint#2822 Signed-off-by: Zheng Ruoqin <[email protected]> Signed-off-by: Khem Raj <[email protected]>
What's New in astroid 2.5.3? ============================ Release Date: 2021-04-10 * Takes into account the fact that subscript inferring for a ClassDef may involve __class_getitem__ method * Reworks the `collections` and `typing` brain so that `pylint`s acceptance tests are fine. Closes pylint-dev/pylint#4206 * Use ``inference_tip`` for ``typing.TypedDict`` brain. * Fix mro for classes that inherit from typing.Generic * Add inference tip for typing.Generic and typing.Annotated with ``__class_getitem__`` Closes pylint-dev/pylint#2822 Signed-off-by: Zheng Ruoqin <[email protected]> Signed-off-by: Khem Raj <[email protected]>
What's New in astroid 2.5.3? ============================ Release Date: 2021-04-10 * Takes into account the fact that subscript inferring for a ClassDef may involve __class_getitem__ method * Reworks the `collections` and `typing` brain so that `pylint`s acceptance tests are fine. Closes pylint-dev/pylint#4206 * Use ``inference_tip`` for ``typing.TypedDict`` brain. * Fix mro for classes that inherit from typing.Generic * Add inference tip for typing.Generic and typing.Annotated with ``__class_getitem__`` Closes pylint-dev/pylint#2822 Signed-off-by: Zheng Ruoqin <[email protected]> Signed-off-by: Khem Raj <[email protected]>
What's New in astroid 2.5.3? ============================ Release Date: 2021-04-10 * Takes into account the fact that subscript inferring for a ClassDef may involve __class_getitem__ method * Reworks the `collections` and `typing` brain so that `pylint`s acceptance tests are fine. Closes pylint-dev/pylint#4206 * Use ``inference_tip`` for ``typing.TypedDict`` brain. * Fix mro for classes that inherit from typing.Generic * Add inference tip for typing.Generic and typing.Annotated with ``__class_getitem__`` Closes pylint-dev/pylint#2822 Signed-off-by: Zheng Ruoqin <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Trevor Gamblin <[email protected]>
What's New in astroid 2.5.3? ============================ Release Date: 2021-04-10 * Takes into account the fact that subscript inferring for a ClassDef may involve __class_getitem__ method * Reworks the `collections` and `typing` brain so that `pylint`s acceptance tests are fine. Closes pylint-dev/pylint#4206 * Use ``inference_tip`` for ``typing.TypedDict`` brain. * Fix mro for classes that inherit from typing.Generic * Add inference tip for typing.Generic and typing.Annotated with ``__class_getitem__`` Closes pylint-dev/pylint#2822 Signed-off-by: Zheng Ruoqin <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Trevor Gamblin <[email protected]> (cherry picked from commit b06d10f) Signed-off-by: Armin Kuster <[email protected]>
What's New in astroid 2.5.3? ============================ Release Date: 2021-04-10 * Takes into account the fact that subscript inferring for a ClassDef may involve __class_getitem__ method * Reworks the `collections` and `typing` brain so that `pylint`s acceptance tests are fine. Closes pylint-dev/pylint#4206 * Use ``inference_tip`` for ``typing.TypedDict`` brain. * Fix mro for classes that inherit from typing.Generic * Add inference tip for typing.Generic and typing.Annotated with ``__class_getitem__`` Closes pylint-dev/pylint#2822 Signed-off-by: Zheng Ruoqin <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Trevor Gamblin <[email protected]>
What's New in astroid 2.5.3? ============================ Release Date: 2021-04-10 * Takes into account the fact that subscript inferring for a ClassDef may involve __class_getitem__ method * Reworks the `collections` and `typing` brain so that `pylint`s acceptance tests are fine. Closes pylint-dev/pylint#4206 * Use ``inference_tip`` for ``typing.TypedDict`` brain. * Fix mro for classes that inherit from typing.Generic * Add inference tip for typing.Generic and typing.Annotated with ``__class_getitem__`` Closes pylint-dev/pylint#2822 Signed-off-by: Zheng Ruoqin <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Trevor Gamblin <[email protected]>
(This might be a part of #2416, but I already have those changes)
Pylint reports
unsubscriptable-object
for abstract generic types:Steps to reproduce
Run pylint on following file:
Current behavior
Pylint reports
E1136: Value 'Factory' is unsubscriptable (unsubscriptable-object)
on line 11.Expected behavior
As far as I understand, this is supposed to be ok?
mypy 0.660
doesn't complain and python 3.7.1 runs the whole thing.pylint --version output
The text was updated successfully, but these errors were encountered: