Uh oh!
There was an error while loading. Please reload this page.
bpo-30241: implement contextlib.AbstractAsyncContextManager - #1412
Conversation
mention-bot
commented
May 3, 2017
@JelleZijlstra, thanks for your PR! By analyzing the history of the files in this pull request, we identified @ncoghlan, @birkenfeld and @rhettinger to be potential reviewers. |
| def __subclasshook__(cls, C): | ||
| if cls is AbstractAsyncContextManager: | ||
| if (any("__aenter__" in B.__dict__ for B in C.__mro__) and | ||
| any("__aexit__" in B.__dict__ for B in C.__mro__)): |
There was a problem hiding this comment.
I understand you just copied this from above, but I think both should be updated to support the explicit "anti-registration" __enter__ = None pattern, like all classes in collections.abc, see _check_methods function in _collections_abc.py.
There was a problem hiding this comment.
Maybe that should be a separate issue? AbstractContextManager should arguably be fixed even in 3.6, and this PR only targets 3.7. I can fix AbstractAsyncContextManager though.
There was a problem hiding this comment.
Yes, a separate PR for 3.6 is needed. But I think it makes sense to already fix the async version here.
There was a problem hiding this comment.
Filed http://bugs.python.org/issue30266 to track that.
gvanrossum
commented
Jun 9, 2017
Wait, isn't this a new feature that should go into 3.7? |
ilevkivskyi
commented
Jun 9, 2017
Oh yes, sorry, this one is not urgent then. |
Implements: - python/typing#438 - python/cpython#360python/cpython#1412, which adds contextlib.AbstractAsyncContextManager, has not yet been merged.
) Implements: - python/typing#438 - python/cpython#360 Note that python/cpython#1412, which adds contextlib.AbstractAsyncContextManager, has not yet been merged.
1st1
commented
Oct 10, 2017
Please add a NEWS entry and I'll merge this in. |
JelleZijlstra
commented
Oct 11, 2017
Thanks, just pushed a NEWS entry. |
| .. class:: AbstractAsyncContextManager | ||
| An :term:`abstract base class` similar to |
There was a problem hiding this comment.
I'm wondering if we could just copy the paragraph from AbstractContextManager doc. "similar to" isn't easy to read here.
The PR #4790 adds |
ilevkivskyi
commented
Dec 13, 2017
@JelleZijlstra Could you please fix the merge conflict and update the docs as @1st1 proposed? I would like to have this merged soon. |
1st1
commented
Dec 14, 2017
Thanks @JelleZijlstra! |
JelleZijlstra
commented
Dec 14, 2017
Thanks, and sorry for dropping the ball on making the docs change! |
1st1
commented
Dec 14, 2017
NP ;) |
ilevkivskyi
commented
Dec 14, 2017
Thank you @JelleZijlstra and @1st1 ! |
https://bugs.python.org/issue30241