Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix edge-case Protocol bug on Python 3.7#242

Merged
JelleZijlstra merged 2 commits into
python:mainpython/typing_extensions:mainfrom
AlexWaygood:proto-subclass-bugAlexWaygood/typing_extensions:proto-subclass-bugCopy head branch name to clipboard
Jun 16, 2023
Merged

Fix edge-case Protocol bug on Python 3.7#242
JelleZijlstra merged 2 commits into
python:mainpython/typing_extensions:mainfrom
AlexWaygood:proto-subclass-bugAlexWaygood/typing_extensions:proto-subclass-bugCopy head branch name to clipboard

Conversation

@AlexWaygood

Copy link
Copy Markdown
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.

Comment thread src/typing_extensions.py
@JelleZijlstra JelleZijlstra merged commit af89916 into python:main Jun 16, 2023
@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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.