New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runtime-checkable protocols are broken on py312 (the sequel) #104935
Labels
3.12
bugs and security fixes
3.13
bugs and security fixes
topic-typing
type-bug
An unexpected behavior, bug, or error
Comments
AlexWaygood
added
type-bug
An unexpected behavior, bug, or error
topic-typing
3.12
bugs and security fixes
3.13
bugs and security fixes
labels
May 25, 2023
JelleZijlstra
added a commit
to JelleZijlstra/cpython
that referenced
this issue
May 25, 2023
AlexWaygood
added a commit
that referenced
this issue
May 25, 2023
…`Generic` (#104939) --------- Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
May 25, 2023
…` and `Generic` (pythonGH-104939) --------- (cherry picked from commit 2b7027d) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
May 25, 2023
…` and `Generic` (pythonGH-104939) --------- (cherry picked from commit 2b7027d) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3.12
bugs and 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: