Skip to content

unsubscriptable-object error reported incorrectly #2416

Closed
@pbasista

Description

@pbasista

Steps to reproduce

Run Pylint on the following code:

from typing import Generic, TypeVar

T = TypeVar("T")

class Test(Generic[T]):  # error is reported here
    pass

Current behavior

Pylint reports the following error:
E1136: Value 'Generic' is unsubscriptable (unsubscriptable-object)

Expected behavior

No error should be reported. Python documentation for Generic explicitly lists use cases where Generic is subscripted.

pylint --version output

$ pylint --version
pylint 2.1.1
astroid 2.0.4
Python 3.7.0 (default, Jun 27 2018, 14:40:03) 
[GCC 8.1.0]

This issue is not reproducible with Python 3.6. Might be related to issue #2377, which is only reproducible with Python 3.6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions