from typing import Iterable
print(isinstance([], Iterable))
Similar issues exist for other generic collection types such as Sized, Mapping etc.
Second argument of isinstance is not a type (isinstance-second-argument-not-valid-type)
No warning is issued.
When collections.abc.Iterable is used instead, there is no warning issued. But the way that class is aliased in the typing module is probably too complex for static analysis to deal with and there doesn't seem to be explicit support yet to work around that.
$ pylint --version
pylint 2.5.0-dev1
astroid 2.4.0
Python 3.8.2 (default, Mar 05 2020, 18:58:42) [GCC]
The astroid version is a dev snapshot as well, but not reported as such. To be exact, I'm using pylint at 0ccf1bca and astroid at f6a36d91.
Thanks, I can confirm the bug. It seems we're inferring typing.Iterable as an instance rather than a class.
I confirm the bug with typing.Dict.
Also with typing.List
Also with typing.Generator.
Also happened with typing.Match, pylint version 2.5.2.
I think we can safely assume it is all protocols, so we don't need to exhaustively and separately report them all.
Most helpful comment
Also with typing.List