Message356962
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. |
|
Date |
User |
Action |
Args |
2019-11-19 11:54:28 | srittau | set | recipients:
+ srittau, asvetlov, yselivanov |
2019-11-19 11:54:28 | srittau | set | messageid: <1574164468.11.0.934598090921.issue38846@roundup.psfhosted.org> |
2019-11-19 11:54:28 | srittau | link | issue38846 messages |
2019-11-19 11:54:27 | srittau | create | |
|