Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
Closed
Description
Bug report
On Python 3.11, you can do this:
>>>import typing>>>issubclass(object, typing.Protocol)False
But on Python 3.12 (following the backport ofc05c31d), this raises:
>>>import typing>>>issubclass(object, typing.Protocol)Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\alexw\coding\cpython\Lib\typing.py", line 1797, in __subclasscheck__ raise TypeError(TypeError: Instance and class checks can only be used with @runtime_checkable protocols
The new behaviour doesn't make sense. ThatTypeError
should only be triggered if a user is callingissubclass()
against asubclass oftyping.Protocol
.typing.Protocol
itself should be exempted.