Skip to content

Regression: Value 'Collection' is unsubscriptable  #2377

Closed
@Spacerat

Description

@Spacerat

Steps to reproduce

Run pylint on this file

from typing import Collection

def myfunc(arg: Collection[int]):
    print(arg)

myfunc([1, 2, 3])

Current behavior

repro.py:3:16: E1136: Value 'Collection' is unsubscriptable (unsubscriptable-object)

Expected behavior

No errors.

pylint --version output

Breaks for 2.1.0:

pylint 2.1.0
astroid 2.0.2
Python 3.6.4 (default, Mar 12 2018, 17:50:21)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]

Does not break for 1.9.2:

pylint 1.9.2,
astroid 1.6.5
Python 3.6.4 (default, Mar 12 2018, 17:50:21)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]

If there is a configuration workaround for this (except for disabling unsubscriptable-object globally) that would be nice, but neither ignored-modules=typing or ignored-classes=Collection worked for me.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions