pytype icon indicating copy to clipboard operation
pytype copied to clipboard

Error when calling isinstance with TypeVar

Open eltoder opened this issue 2 years ago • 0 comments

import typing

def test(x) -> bool:
    return isinstance(x, typing.TypeVar)

This produces an unexpected error:

File "/home/elt/code/pytype-test/proj/type_var.py", line 4, in test: Built-in function isinstance was called with the wrong arguments [wrong-arg-types]
         Expected: (object, class_or_type_or_tuple: Union[Tuple[Union[Tuple[type, ...], type], ...], type])
  Actually passed: (object, class_or_type_or_tuple: type)

For the reference, this works in mypy.

eltoder avatar Jul 03 '23 22:07 eltoder