Skip to content

Conversation

@ilevkivskyi
Copy link
Member

Fixes #4536

This use case is specified by PEP 544 but was not implemented. Only instances (not class objects) were allowed as protocol implementations. The PR is quite straightforward, essentially I just pass a class_obj flag everywhere to know whether we need or not to bind self in a method.

cc @JukkaL

@github-actions

This comment has been minimized.

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@ilevkivskyi ilevkivskyi merged commit 9431d47 into python:master Aug 24, 2022
@ilevkivskyi ilevkivskyi deleted the more-proto-impls branch August 24, 2022 23:25
ilevkivskyi added a commit that referenced this pull request Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Protocols should not care if a type is a class or an instance

2 participants