Skip to content

Improve imp._FileLike.__exit__ #7577

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 1 commit into from
Apr 1, 2022
Merged

Improve imp._FileLike.__exit__ #7577

merged 1 commit into from
Apr 1, 2022

Conversation

AlexWaygood
Copy link
Member

The signature of this method currently doesn't work quite as intended: see PyCQA/flake8-pyi#199 (comment)

Classes will still be accepted as conforming to this protocol if they have more permissive signatures such as def __exit__(self, *args: object) -> None: ...

The signature of this method currently doesn't work quite as intended: see PyCQA/flake8-pyi#199 (comment)

Classes will [still be accepted](https://mypy-play.net/?mypy=latest&python=3.10&gist=77efe095d01edeb1a4614166f0c9cf68) as conforming to this protocol if they have more permissive signatures such as `def __exit__(self, *args: object) -> None: ...`
@AlexWaygood AlexWaygood requested a review from Akuli April 1, 2022 16:51
Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

Contravariance to the rescue

@github-actions
Copy link
Contributor

github-actions bot commented Apr 1, 2022

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

@AlexWaygood AlexWaygood merged commit 646993c into master Apr 1, 2022
@AlexWaygood AlexWaygood deleted the AlexWaygood-patch-1 branch April 1, 2022 17:01
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