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 <rep...@bugs.python.org>
<http://bugs.python.org/issue26373>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to