-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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
Cannot call issubclass()
against typing.Protocol
on Python 3.12
#105237
Comments
…pythonGH-105239) (cherry picked from commit cdfb201) Co-authored-by: Alex Waygood <[email protected]>
While working on fixing the bug, we discovered another bug, where |
Well, but on the other hand, I'm hesitant to touch 3.11 here, given that it's an edge-case bug, and it's hard to do a proper fix that's not somewhat invasive. So, I'll close this for now. (But if somebody else disagrees and wants to have a go at fixing it on 3.11, happy to reopen.) |
Bug report
On Python 3.11, you can do this:
But on Python 3.12 (following the backport of c05c31d), this raises:
The new behaviour doesn't make sense. That
TypeError
should only be triggered if a user is callingissubclass()
against a subclass oftyping.Protocol
.typing.Protocol
itself should be exempted.Linked PRs
issubclass(X, typing.Protocol)
again #105239issubclass(X, typing.Protocol)
again (GH-105239) #105316The text was updated successfully, but these errors were encountered: