[New-bugs-announce] [issue26373] asyncio: add support for async context manager on streams?

STINNER Victor report at bugs.python.org
Wed Feb 17 06:30:21 EST 2016


New submission from STINNER Victor:

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

----------
components: asyncio
messages: 260394
nosy: gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: asyncio: add support for async context manager on streams?
type: enhancement
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26373>
_______________________________________


More information about the New-bugs-announce mailing list