GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add AsyncContextManager generic class by ilevkivskyi · Pull Request #438 · python/typing

Conversation

@ilevkivskyi

@ilevkivskyi ilevkivskyi commented Jun 9, 2017

Copy link
Copy Markdown
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+.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ilevkivskyi and others added 3 commits June 9, 2017 12:47
@ilevkivskyi
Add AsyncContextManager
2f00d3e
Ivan Levkivskyi
Fix lint and underscore
dffa255
Ivan Levkivskyi
A real fix of import
2cbdb1b
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Jun 9, 2017
Ivan Levkivskyi added 3 commits June 9, 2017 14:45
Ivan Levkivskyi
Only import on newer versions
cd137de
Ivan Levkivskyi
Inline _check_methods on Python 3.5 similar to AsyncIterator
d0eea94
Ivan Levkivskyi
Fix whitespace
8b19224
gvanrossum
gvanrossum reviewed Jun 9, 2017
View reviewed changes
Comment thread src/test_typing.py
yield 42

cm = manager()
self.assertNotIsInstance(cm, typing.AsyncContextManager)

@gvanrossum gvanrossum Jun 9, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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 ...?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Ivan Levkivskyi
Add a test that shows how to use AsyncContextManager (and two more te…
1283d70
…sts)
@JelleZijlstra

JelleZijlstra commented Jun 9, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

gvanrossum commented Jun 9, 2017

Copy link
Copy Markdown
Member

Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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
@JelleZijlstra
add typing.AsyncContextManager and contextlib.asynccontextmanager
32977e0
Implements:
- python/typing#438
- python/cpython#360

python/cpython#1412, which adds
contextlib.AbstractAsyncContextManager, has not yet been merged.
@JelleZijlstra JelleZijlstra mentioned this pull request Jun 24, 2017
add typing.AsyncContextManager and contextlib.asynccontextmanager python/typeshed#1432
Merged
gvanrossum pushed a commit to python/typeshed that referenced this pull request Jun 27, 2017
@JelleZijlstra @gvanrossum
add typing.AsyncContextManager and contextlib.asynccontextmanager (#1432
22f47fd
)

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

Reviewers

@gvanrossum gvanrossum gvanrossum left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA signed

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@ilevkivskyi @JelleZijlstra @gvanrossum @the-knights-who-say-ni
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.