classification
Title: asyncio: add support for async context manager on streams?
Type: enhancement Stage: resolved
Components: asyncio Versions: Python 3.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, martin.panter, python-dev, vstinner, yselivanov
Priority: normal Keywords:

Created on 2016-02-17 11:30 by vstinner, last changed 2017-06-28 01:11 by vstinner. This issue is now closed.

Messages (4)
msg260394 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-02-17 11:30
While working on the issue #24911 (Context manager of socket.socket is not documented), I recalled that asyncio objects don't support context manager. With the PEP 492, it becomes possible to add support for async context manager for a few asyncio objects. I suggest to start with StreamWriter.

Usually, my rationale to decide which object should implement context manager is to check if the destructor can emit ResourceWarning.

In asyncio, ResourceWarning is now emitted by transport and event loop destructors:
https://docs.python.org/dev/library/asyncio-dev.html#close-transports-and-event-loops
msg267201 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-06-04 00:34
New changeset 883cfb3e28f9 by Gregory P. Smith in branch '3.5':
Fixes Issue #26373: subprocess.Popen.communicate now correctly ignores
https://hg.python.org/cpython/rev/883cfb3e28f9

New changeset 78e81de6d447 by Gregory P. Smith in branch 'default':
merge from 3.5 - Fixes Issue #26373: subprocess.Popen.communicate
https://hg.python.org/cpython/rev/78e81de6d447
msg267243 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-06-04 08:04
Above two commits were actuall for Issue 26372
msg297105 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-06-28 01:11
I'm not sure asynico anymore and lost track of this issue, so I just close it.
History
Date User Action Args
2017-06-28 01:11:31vstinnersetstatus: open -> closed
resolution: out of date
messages: + msg297105

stage: resolved
2016-06-04 08:04:21martin.pantersetnosy: + martin.panter
messages: + msg267243
2016-06-04 00:34:31python-devsetnosy: + python-dev
messages: + msg267201
2016-02-17 11:30:21vstinnercreate