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

use Self in async context managers #5724

Merged
merged 4 commits into from
Jul 6, 2021
Merged

use Self in async context managers #5724

merged 4 commits into from
Jul 6, 2021

Conversation

Akuli
Copy link
Collaborator

@Akuli Akuli commented Jul 4, 2021

Resolves this comment #5712 (comment)

@@ -103,9 +101,9 @@ if sys.version_info >= (3, 7):
def push_async_exit(self, exit: _ACM_EF) -> _ACM_EF: ...
def callback(self, callback: Callable[..., Any], *args: Any, **kwds: Any) -> Callable[..., Any]: ...
def push_async_callback(self, callback: _CallbackCoroFunc, *args: Any, **kwds: Any) -> _CallbackCoroFunc: ...
def pop_all(self: _S) -> _S: ...
def pop_all(self: Self) -> Self: ...
Copy link
Contributor

@graingert graingert Jul 4, 2021

Choose a reason for hiding this comment

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

This method is on _BaseExitStack

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The purpose of _BaseExitStack is to avoid copy/pasta in the implementation. On the one hand, we don't need it in typeshed because the stubs are short anyway, but on the other hand, it is generally good if stubs match the implementation. Either way, adding _BaseExitStack is beyond the scope of this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

This will need to be fixed on both copies of pop_all instead

@github-actions

This comment has been minimized.

@Akuli Akuli changed the title use Self in contextlib.AsyncExitStack use Self in async context managers Jul 4, 2021
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2021

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

@srittau srittau merged commit 42247fe into python:master Jul 6, 2021
@Akuli Akuli deleted the self branch July 6, 2021 19:16
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.

3 participants