[issue45326] Unexpected TypeError with type alias+issubclass+ABC

Andrei Kulakov report at bugs.python.org
Sun Feb 27 20:51:26 EST 2022


Andrei Kulakov <andrei.avk at gmail.com> added the comment:

This error was added in https://bugs.python.org/issue33018 . See some discussion on that issue.

Note that first arg needs to be a type (i.e. instance of `type`) to avoid this error:

[ins] In [41]: class C(ABC):0

[ins] In [42]: issubclass(dict, C)
Out[42]: False

[ins] In [43]: issubclass('', C)  # TypeError: issubclass() arg 1 must be a class

[ins] In [44]: issubclass(typing.Dict, C)   # same error as above

----------
nosy: +andrei.avk

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45326>
_______________________________________


More information about the Python-bugs-list mailing list