Skip to content

Reduce duplication of code between typing and typing_extensions #7075

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

Merged
merged 9 commits into from
Jan 29, 2022

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Jan 29, 2022

Following #7037, we now (ab)use the fact that Protocol is defined unconditionally in typing.pyi as a means to avoid redefining Protocol in typing_extensions (we just re-export it from typing). This means that we no longer have to define _ProtocolMeta in typing_extensions, since its only purpose is to define the Protocol class.

We can also import the definition of _SpecialForm from typing, which should help stop them getting out of sync in the future (they are already out of sync now).

^Seems like importing _SpecialForm breaks pytype, unfortunately.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

3 similar comments
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

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

@JelleZijlstra JelleZijlstra merged commit 99cec2d into python:master Jan 29, 2022
@AlexWaygood AlexWaygood deleted the Typing branch January 29, 2022 15:51
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