Skip to content
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

Fix edge-case Protocol bug on Python 3.7 #242

Merged
merged 2 commits into from
Jun 16, 2023

Conversation

AlexWaygood
Copy link
Member

This line is buggy. As a result of the bug, several of the assertions added in python/cpython#105835 don't pass on Python 3.7:

and issubclass(other, (typing.Generic, _ProtocolMeta))

It should be

issubclass(other, typing.Generic) or isinstance(other, _ProtocolMeta)

But we can also rewrite the condition more elegantly using the new is_protocol function, so that's what I've done in this PR.

@JelleZijlstra JelleZijlstra merged commit af89916 into python:main Jun 16, 2023
16 checks passed
@AlexWaygood AlexWaygood deleted the proto-subclass-bug branch June 16, 2023 16:07
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.

2 participants