-
-
Notifications
You must be signed in to change notification settings - Fork 35k
bpo-38066: Hide internal Stream methods #15762
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1133,9 +1133,9 @@ def connection_lost(self, exc): | |||||
| stream = self._stream | ||||||
| if stream is not None: | ||||||
| if exc is None: | ||||||
| stream.feed_eof() | ||||||
| stream._feed_eof() | ||||||
| else: | ||||||
| stream.set_exception(exc) | ||||||
| stream._set_exception(exc) | ||||||
| if not self._closed.done(): | ||||||
| if exc is None: | ||||||
| self._closed.set_result(None) | ||||||
|
|
@@ -1147,12 +1147,12 @@ def connection_lost(self, exc): | |||||
| def data_received(self, data): | ||||||
| stream = self._stream | ||||||
| if stream is not None: | ||||||
| stream.feed_data(data) | ||||||
| stream._feed_data(data) | ||||||
|
|
||||||
| def eof_received(self): | ||||||
| stream = self._stream | ||||||
| if stream is not None: | ||||||
| stream.feed_eof() | ||||||
| stream._feed_eof() | ||||||
| if self._over_ssl: | ||||||
| # Prevent a warning in SSLProtocol.eof_received: | ||||||
| # "returning true from eof_received() | ||||||
|
|
@@ -1219,7 +1219,7 @@ def connection_made(self, transport): | |||||
| stream = self._stream | ||||||
| if stream is None: | ||||||
| return | ||||||
| stream.set_transport(transport) | ||||||
| stream._set_transport(transport) | ||||||
| stream._protocol = self | ||||||
|
|
||||||
| def connection_lost(self, exc): | ||||||
|
|
@@ -1351,6 +1351,11 @@ def is_server_side(self): | |||||
|
|
||||||
| @property | ||||||
| def transport(self): | ||||||
| warnings.warn("Stream.transport attribute is deprecated " | ||||||
| "since Python 3.8 and is scheduled for removal in 3.10; " | ||||||
| "it is an internal API", | ||||||
| DeprecationWarning, | ||||||
| stacklevel=2) | ||||||
| return self._transport | ||||||
|
|
||||||
| def write(self, data): | ||||||
|
|
@@ -1366,7 +1371,7 @@ def writelines(self, data): | |||||
| def _fast_drain(self): | ||||||
| # The helper tries to use fast-path to return already existing | ||||||
| # complete future object if underlying transport is not paused | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fast drain works with the single object, not multiple ones.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Oops, I'll adjust the suggestion. |
||||||
| #and actual waiting for writing resume is not needed | ||||||
| # and actual waiting for writing resume is not needed | ||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||||||
| exc = self.exception() | ||||||
| if exc is not None: | ||||||
| fut = self._loop.create_future() | ||||||
|
|
@@ -1450,6 +1455,14 @@ def exception(self): | |||||
| return self._exception | ||||||
|
|
||||||
| def set_exception(self, exc): | ||||||
| warnings.warn("Stream.set_exception() is deprecated " | ||||||
| "since Python 3.8 and is scheduled for removal in 3.10; " | ||||||
| "it is an internal API", | ||||||
| DeprecationWarning, | ||||||
| stacklevel=2) | ||||||
| self._set_exception(exc) | ||||||
|
|
||||||
| def _set_exception(self, exc): | ||||||
| self._exception = exc | ||||||
|
|
||||||
| waiter = self._waiter | ||||||
|
|
@@ -1467,6 +1480,14 @@ def _wakeup_waiter(self): | |||||
| waiter.set_result(None) | ||||||
|
|
||||||
| def set_transport(self, transport): | ||||||
| warnings.warn("Stream.set_transport() is deprecated " | ||||||
| "since Python 3.8 and is scheduled for removal in 3.10; " | ||||||
| "it is an internal API", | ||||||
| DeprecationWarning, | ||||||
| stacklevel=2) | ||||||
| self._set_transport(transport) | ||||||
|
|
||||||
| def _set_transport(self, transport): | ||||||
| if transport is self._transport: | ||||||
| return | ||||||
| assert self._transport is None, 'Transport already set' | ||||||
|
|
@@ -1478,6 +1499,14 @@ def _maybe_resume_transport(self): | |||||
| self._transport.resume_reading() | ||||||
|
|
||||||
| def feed_eof(self): | ||||||
| warnings.warn("Stream.feed_eof() is deprecated " | ||||||
| "since Python 3.8 and is scheduled for removal in 3.10; " | ||||||
| "it is an internal API", | ||||||
| DeprecationWarning, | ||||||
| stacklevel=2) | ||||||
| self._feed_eof() | ||||||
|
|
||||||
| def _feed_eof(self): | ||||||
| self._eof = True | ||||||
| self._wakeup_waiter() | ||||||
|
|
||||||
|
|
@@ -1486,6 +1515,14 @@ def at_eof(self): | |||||
| return self._eof and not self._buffer | ||||||
|
|
||||||
| def feed_data(self, data): | ||||||
| warnings.warn("Stream.feed_data() is deprecated " | ||||||
| "since Python 3.8 and is scheduled for removal in 3.10; " | ||||||
| "it is an internal API", | ||||||
| DeprecationWarning, | ||||||
| stacklevel=2) | ||||||
| self._feed_data(data) | ||||||
|
|
||||||
| def _feed_data(self, data): | ||||||
| _ensure_can_read(self._mode) | ||||||
| assert not self._eof, 'feed_data after feed_eof' | ||||||
|
|
||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.
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.
asyncio itself never uses this property, there is no need for readonly internal API version