[issue38846] async: Return context manager from open(_unix)_connection

2019-12-05 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38846] async: Return context manager from open(_unix)_connection

2019-11-19 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

>From my understanding, Yuri doesn't want to improve the existing streaming API 
>but invent something blessing new.

The improvement like you proposed has a very low chance to be accepted.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38846] async: Return context manager from open(_unix)_connection

2019-11-19 Thread Sebastian Rittau


New submission from Sebastian Rittau :

As a convenience it would be useful if async.open_connection() and 
open_unix_connection() would return a context manager that closes the writer on 
exit:

with await open_unix_connection(...) as (reader, writer):
...

This could be achieved by using a custom sub-class of tuple:

class _ConnectionContext(tuple):
def __enter__(self):
return self
def __exit__(self, *args):
self[1].close()

I can submit a PR if wanted.

--
components: asyncio
messages: 356962
nosy: asvetlov, srittau, yselivanov
priority: normal
severity: normal
status: open
title: async: Return context manager from open(_unix)_connection
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com