Skip to content

isinstance(..., abc.Callable) not supported #1604

@randolf-scholz

Description

@randolf-scholz

Describe the Bug

from collections.abc import Callable

assert isinstance(len, Callable)  # E: Expected class object, got `type[Callable]`

Python: 3.12

This is supported at runtime and by other type checkers, and more or less equivalent to callable(...). cpython source

Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeS4ATrgLYAEAxrlLAwC4S7pyGrYN0INYrkps6AYVQs%2BsADroFqOHBhjBcCNzYYGMABSx0AGknSosmAEoFIYyACuHKDzIUAxHQCqziG1J0YA7o7JzcCgqYMGCBojSobAD66A402Gr6%2BIiC6GxWdAC0AHx0cGyUiAp01XSUMGwOlOiBciAAcqnpFXTA%2BAC%2Brbb2ZHVgUKSEbLRQHnQACqSj46UYOASMXJAA5o0JYYQKngDKMDB0ABZsbMRwiAD0dyPR44SiW3cw6HeYuAxwd0x0NtdhwuHdYpQ6KgAG6oaCWDZAiA7Sh7Lh0XDEUHcA7oMhsc5cArQtSadEAXjorQAzIQAIwAJkG6BAfXsqFCJIAYtAYBQ0Fg8EQ3H0gA

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions