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

Changed typing_extensions.pyi to declare its own private version of Protocol #7133

Merged
merged 3 commits into from
Feb 5, 2022

Conversation

erictraut
Copy link
Contributor

Changed typing_extensions.pyi to declare its own private version of Protocol rather than re-exporting the symbol imported from typing. This allows pyright to warn users about runtime exceptions when they attempt to use typing.Protocol on versions of Python prior to 3.7.

…Protocol` rather than re-exporting the symbol imported from `typing`. This allows pyright to warn users about runtime exceptions when they attempt to use typing.Protocol on versions of Python prior to 3.7.
@erictraut
Copy link
Contributor Author

This is related to issue #7130

@AlexWaygood
Copy link
Member

Should the changes #7037 made to runtime_checkable also be reverted?

@github-actions

This comment has been minimized.

@erictraut
Copy link
Contributor Author

Pyright doesn't currently have a version check for runtime_checkable, so that change wouldn't have any effect. I don't mind adding it for consistency if you'd prefer.

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member

Pyright doesn't currently have a version check for runtime_checkable, so that change wouldn't have any effect. I don't mind adding it for consistency if you'd prefer.

I'm easy either way if it doesn't break pyright :) I vote for leaving it as it is in that case — it keeps code duplication to a minimum

@JelleZijlstra
Copy link
Member

Actually I'd prefer we change it too, so that any type checker that does want to error for use of runtime_checkable on 3.6 can do so.

@erictraut
Copy link
Contributor Author

@JelleZijlstra, I've reverted the recent change for runtime_checkable as you suggested.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2022

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

@JelleZijlstra JelleZijlstra merged commit 7dc5bed into python:master Feb 5, 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.

4 participants