This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: New asyncio streams API
Type: Stage: resolved
Components: Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Merge StreamWriter and StreamReader into just asyncio.Stream
View: 36889
Assigned To: Nosy List: asvetlov, xtreak
Priority: normal Keywords: patch

Created on 2018-09-11 21:18 by asvetlov, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 9183 closed asvetlov, 2018-09-11 21:18
Messages (3)
msg325064 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2018-09-11 21:18
Currently, we have separate classes: reader and writer.

It is very inconvenient: these classes are tightly coupled internally, there is no sense to have two objects to the single logical entity.

The second problem is `writer.write()` synchronous API. To support flow control user should call `await writer.drain()` after every `writer.write()` call. But he/she can forget about drain() easy.

`writer.write()` should be softly deprecated in favor of `await writer.send()`. `writer.writelines()` is not very useful, better to merge all buffers before `await stream.send(data)` call. `writelines` should be softly deprecated as well without async replacement.

The last issue is `writer.close()` which should always be used in conjunction with `await writer.wait_closed()`. Let's return a future from `writer.close()`. The encouraged usage becomes `await writer.close()`. 
To immediate closing let's add `writer.abort()` sync function which cleans up resources without waiting for actual closing.
msg351974 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-09-11 16:44
Streams API is implemented as part of issue36889 in 3.8. I think we can close this as a duplicate. Thanks.
msg352003 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2019-09-11 17:47
Yes, please do
History
Date User Action Args
2022-04-11 14:59:05adminsetgithub: 78815
2019-09-11 17:54:00xtreaksetstatus: open -> closed
resolution: duplicate
superseder: Merge StreamWriter and StreamReader into just asyncio.Stream
stage: patch review -> resolved
2019-09-11 17:47:44asvetlovsetmessages: + msg352003
2019-09-11 16:44:36xtreaksetnosy: + xtreak
messages: + msg351974
2018-09-11 21:18:54asvetlovsetkeywords: + patch
stage: patch review
pull_requests: + pull_request8621
2018-09-11 21:18:02asvetlovcreate