-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Behaviour change in py312 for protocols with non-callable members and custom __subclasshook__
methods
#105974
Comments
…with non-callable members and custom `__subclasshook__` methods
There is an argument that this behaviour change should be considered a feature rather than a bug. Mypy will complain about The "feature" where users can define custom But the behaviour change in Python 3.12 was unintentional, and could break some users? I'm not sure really. |
@JelleZijlstra, thoughts on this? Is there a case to be made that the new behaviour should be considered a feature rather than a bug? |
I think the new behavior is a bug; we shouldn't be clobbering people's |
SGTM |
…on-callable members and custom `__subclasshook__` methods (#105976)
…with non-callable members and custom `__subclasshook__` methods (pythonGH-105976) (cherry picked from commit 9499b0f) Co-authored-by: Alex Waygood <[email protected]>
… with non-callable members and custom `__subclasshook__` methods (GH-105976) (#106032) gh-105974: Revert unintentional behaviour change for protocols with non-callable members and custom `__subclasshook__` methods (GH-105976) (cherry picked from commit 9499b0f) Co-authored-by: Alex Waygood <[email protected]>
Bug report
On Python 3.11:
On Python 3.12:
I think I prefer the Python 3.11 behaviour here, since the whole point of allowing protocols to define custom
__subclasshook__
methods is so that users can customise howissubclass()
works on user-defined protocols.Linked PRs
__subclasshook__
methods #105976__subclasshook__
methods (GH-105976) #106032The text was updated successfully, but these errors were encountered: