-
-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-38242: Revert new asyncio streaming API #16455
Conversation
There's still a few areas that I need to work on, but this should have the majority of the important changes. Edit: To clarify, the changes I'm still working on involve adding back some of the deprecation warnings in the tests. Other than that, everything else is okay as far as I can tell. |
Also remove explicit passing of loop to task
…7/cpython into revert-asyncio-streaming
Since StreamReader is now the defacto API with Stream being removed, should its "internal usage only" deprecation warning be removed?
|
Restored Edit: Also restored test_base_events and test_server. The only difference between the restored tests was a removed DeprecationWarning for explicitly passing the loop arg (which should remain). |
@asvetlov will you have time to glance over this today/tomorrow? |
`StreamReaderProtocol` was technically a public API and a lot of people use it. So I'd revert this change entirely. We'll just deprecate all of the current streaming API in 3.9.
…On Sat, Sep 28, 2019 at 11:49 AM, Kyle Stanley < ***@***.*** > wrote:
***@***.**** commented on this pull request.
In Lib/ test/ test_asyncio/ test_windows_events. py (
#16455 (comment) ) :
> @@ -118,16 +117,16 @@ def test_pipe(self): clients = [] for i in
range(5): - stream = asyncio. Stream ( http://asyncio.stream/ ) ( mode=asyncio.
StreamMode. READ ( http://mode=asyncio.streammode.read/ ) , -
loop=self.loop, _asyncio_internal=True) - protocol =
_StreamProtocol(stream, - loop=self.loop, - _asyncio_internal=True) +
stream_reader = asyncio.StreamReader(loop=self.loop, +
_asyncio_internal=True)
@ 1st1 ( https://github.com/1st1 ) It should probably be removed from the __init__
of StreamReader (and all corresponding references) since it's no longer
internal with Stream removed, but it can remain for StreamReaderProtocol
since that class is still intended for internal usage. Is this okay?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub (
#16455?email_source=notifications&email_token=AAB2LG7CVDJD4S34X2JV243QL6RK3A5CNFSM4I3MQJ4KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCGH75FI#discussion_r329322187
) , or mute the thread (
https://github.com/notifications/unsubscribe-auth/AAB2LG2QP775ZTTC76FXZLTQL6RK3ANCNFSM4I3MQJ4A
).
|
Ah, I see. I had never used it myself, but based on the documentation summary of StreamReaderProtocol being an adapter class between Protocol and StreamReader, I had assumed it was primarily intended for internal usage. I'll remove it from both of them if it's considered public API. |
@1st1 Should it be removed from As a result, I would assume it should remain for Process. |
You should use a combination of |
I have been primarily using
It was added by @asvetlov in ad4ed87. The I'll work on removing it from Process though for now, it sounds like you probably don't want it since it was added around that same time. |
I finishing removing all instances of As far as I can tell, that should be everything. All of the tests are passing without any warnings and every component of the new streaming API has been reverted. The only other thing I can think of would be adding the explicit loop arg deprecation to the old API classes. Currently, this does not emit a deprecation warning:
The same applies to StreamReaderProtocol, StreamWriter, SubprocessStreamProtocol, and Process. It was never added to those classes since the deprecation of passing an explicit loop arg was implemented against the new streaming API in 345bfc9 and 6d64a8f. However, that might not be necessary if we're adding another new streaming API in 3.9, so I'll leave that decision up to you two. Let me know if there's anything I'm missing. If I don't respond within a short period of time, feel free to directly commit any suggested changes to the PR. |
While looking over I have no idea how that happened in the first place, but it's fixed now. |
# write(...); await drain() | ||
# in a loop would never call connection_lost(), so it | ||
# would not see an error when the socket is closed. | ||
await tasks.sleep(0, loop=self._loop) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added in commit 23b4b69 with the new streaming API changes, but it looks like it's unrelated. It seems like it would still be quite useful for retaining errors when sockets are closed (see comment on lines 769 - 774 for more info).
Closing in favor of #16482 |
Motivation: Comment in bpo issue from @1st1:
Reverts the following commits from 3.8:
Merge asyncio streams (primary reversion):
23b4b69
Documentation:
b9bfe14
7268fd0
ed9f356
Minor test changes (incompatible with
asyncio.StreamReader
andasyncio.StreamWriter
):4cdbc452ce3
Manual resolution of several conflicts was also required, the majority were for retaining the deprecation of explicitly passing the loop argument for tasks (345bfc9). There might be a few deprecation warnings missing, still working on adding some back.
This PR must be carefully reviewed, especially since it is removing multiple tests that no longer function properly without the changes made in 23b4b69. It is important to be 100% certain that no additional tests were removed. I believe @asvetlov would be the most qualified individual to verify the tests are in a correct state, since he wrote the majority of the tests related to the new streaming API.
It is most of the way there, but additional changes may be needed before it is complete. Until we are certain, I am adding the
DO-NOT-MERGE
label.To @1st1 and @asvetlov:
I have enabled "Allow edits from maintainers" (as I usually do). Please feel free to directly commit changes into the PR. I would appreciate review feedback so that I can understand the reasons behind any changes made, but you certainly don't have to wait on me to make any changes to the PR. Especially since this is a release blocker for 3.8.0.
https://bugs.python.org/issue38242