Skip to content

Conversation

@asvetlov
Copy link
Contributor

@asvetlov asvetlov commented Sep 9, 2019

feed_eof(), feed_data(), set_exception(), and set_transport() are prefixed with underscore now.

https://bugs.python.org/issue38066

Automerge-Triggered-By: @asvetlov

@1st1
Copy link
Member

1st1 commented Sep 9, 2019

@asvetlov Andrew, can we also remove the Stream.transport property?

@asvetlov
Copy link
Contributor Author

asvetlov commented Sep 9, 2019

I think we can but it makes subprocess API a little less backward compatible.
Really wonder how much code is broken.
I'm working on backward-compatible approach: keep all mentioned method plus transport with underscore-prefixed version for internal usage and public version for backward compatibility that raises DeprecationWarding. It is the safest approach that we can do.

@1st1
Copy link
Member

1st1 commented Sep 9, 2019

But asyncio.Stream is a new thing - what backward compatibility problems do we have with it?

@asvetlov
Copy link
Contributor Author

asvetlov commented Sep 9, 2019

create_subprocess_exec / create_subprocess_exec used to work with StreamReader/StreamWriter, now they use asyncio.Stream. The replacement is drop-in, Stream has all API methods from reader and writer.

@1st1
Copy link
Member

1st1 commented Sep 9, 2019

Ah, right! Then your approach with deprecating them gracefully works. Don't forget to also update the docs.

@asvetlov
Copy link
Contributor Author

asvetlov commented Sep 9, 2019

Legacy methods are restored with emitting deprecation warnings.


@property
def transport(self):
warnings.warn("Stream.transport attribute is deprecated "
Copy link
Contributor Author

@asvetlov asvetlov Sep 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asyncio itself never uses this property, there is no need for readonly internal API version

# The helper tries to use fast-path to return already existing
# complete future object if underlying transport is not paused
#and actual waiting for writing resume is not needed
# and actual waiting for writing resume is not needed
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's ok to fix this unrelated comment spacing here. Don't worth a separate PR

Copy link
Contributor

@aeros aeros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @asvetlov.

I have a couple of minor grammar suggestions.


def _fast_drain(self):
# The helper tries to use fast-path to return already existing
# complete future object if underlying transport is not paused
Copy link
Contributor

@aeros aeros Sep 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to the PR, but could make a minor grammar fix here? I could make further suggestions to the phrasing of the code comments for this method, but I figured this suggestion would be easier and uncontroversial.

Suggested change
# complete future object if underlying transport is not paused
# complete future object if the underlying transport is not paused

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast drain works with the single object, not multiple ones.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast drain works with the single object, not multiple ones.

Oops, I'll adjust the suggestion.

@1st1
Copy link
Member

1st1 commented Sep 10, 2019

Great!

@miss-islington miss-islington merged commit 12c122a into python:master Sep 10, 2019
@miss-islington
Copy link
Contributor

Thanks @asvetlov for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 10, 2019
feed_eof(), feed_data(), set_exception(), and set_transport() are prefixed with underscore now.

https://bugs.python.org/issue38066
(cherry picked from commit 12c122a)

Co-authored-by: Andrew Svetlov <[email protected]>
@bedevere-bot
Copy link

GH-15847 is a backport of this pull request to the 3.8 branch.

@asvetlov asvetlov deleted the hide-private-streams-api branch September 10, 2019 12:56
miss-islington added a commit that referenced this pull request Sep 10, 2019
feed_eof(), feed_data(), set_exception(), and set_transport() are prefixed with underscore now.

https://bugs.python.org/issue38066
(cherry picked from commit 12c122a)

Co-authored-by: Andrew Svetlov <[email protected]>
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
feed_eof(), feed_data(), set_exception(), and set_transport() are prefixed with underscore now.


https://bugs.python.org/issue38066
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants