You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Language Server version: Pylance language server 2020.8.1 (pyright 0916fb9e)
OS and version: Ubuntu 20.04
Python version: 3.8.1
Actual behaviour
Recently I am getting a type issue when using isinstance to check for callables:
importtypingastpdeff():
...
print(isinstance(f, tp.Callable)) # Second argument to "isinstance" must be a class or tuple of classes# TypeVar or generic type with type arguments is not allowedPylance (reportGeneralTypeIssues)
According to PEP 484 this should be supported:
Because typing.Callable does double-duty as a replacement for collections.abc.Callable , isinstance(x, typing.Callable) is implemented by deferring to `isinstance(x, collections.abc.Callable) . However, isinstance(x, typing.Callable[...]) is not supported.
Previous versions of Pylance where ok with this type of code.
The text was updated successfully, but these errors were encountered:
Thanks for the bug report. This was a regression related to a recent change I made. I've fixed the problem and augmented the unit tests to prevent similar regressions in the future. The fix will be in the next version of pylance.
Environment data
Actual behaviour
Recently I am getting a type issue when using
isinstance
to check for callables:According to PEP 484 this should be supported:
Previous versions of Pylance where ok with this type of code.
The text was updated successfully, but these errors were encountered: