8000 Add AsyncContextManager generic class by ilevkivskyi · Pull Request #438 · python/typing · GitHub
[go: up one dir, main page]

Skip to content

Add AsyncContextManager generic class #438

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 7 commits into from
Jun 9, 2017

Conversation

ilevkivskyi
Copy link
Member

Asynchronous context managers are defined by PEP 492, but there is no corresponding generic abstract class in typing. This PR adds it for Python 3.5+.

yield 42

cm = manager()
self.assertNotIsInstance(cm, typing.AsyncContextManager)
Copy link
Member

Choose a reason for hiding this comment

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

I'd add a test that also serves as an example of how to use AsyncContextManager (presumably in async with ...?

@JelleZijlstra
Copy link
Member
JelleZijlstra commented Jun 9, 2017

I was planning to do this after AbstractAsyncContextManager is merged into CPython (python/cpython#1412), but there's really no need to wait. The code looks good to me. It would be nice if this can make it into 3.6.2.

@gvanrossum gvanrossum merged commit 74bc3ee into python:master Jun 9, 2017
@gvanrossum
Copy link
Member

Thanks!

@ilevkivskyi ilevkivskyi deleted the add-async-contextmanager branch June 9, 2017 15:47
JelleZijlstra added a commit to JelleZijlstra/typeshed that referenced this pull request Jun 24, 2017
Implements:
- python/typing#438
- python/cpython#360

python/cpython#1412, which adds
contextlib.AbstractAsyncContextManager, has not yet been merged.
gvanrossum pushed a commit to python/typeshed that referenced this pull request Jun 27, 2017
)

Implements:
- python/typing#438
- python/cpython#360

Note that python/cpython#1412, which adds
contextlib.AbstractAsyncContextManager, has not yet been merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0