Runtime-checkable protocols are broken on py312 (the sequel) #104935
Labels
3.12
only security fixes
3.13
bugs and security fixes
topic-typing
type-bug
An unexpected behavior, bug, or error
Bug report
On 3.8-3.11, all subclasses of
typing.Generic
were guaranteed to have an_is_protocol
class attribute, which is used as an internal marker:cpython/Lib/typing.py
Line 1790 in 76873ca
Two places in
typing.py
rely on all subclasses ofGeneric
having this marker:cpython/Lib/typing.py
Lines 1895 to 1897 in dbc8216
cpython/Lib/typing.py
Lines 2062 to 2064 in dbc8216
However, on Python 3.12 (due to the implementation of PEP-695), subclasses of
Generic
no longer have this marker:This leads to
AttributeError
being raised in two situations where it shouldn't be:Cc. @JelleZijlstra for PEP-695
Linked PRs
@runtime_checkable
andGeneric
(GH-104939) #104941The text was updated successfully, but these errors were encountered: