bpo-36801: Fix waiting in StreamWriter.drain for closing SSL transport (GH-13098)

https://bugs.python.org/issue36801
This commit is contained in:
Andrew Svetlov 2019-05-07 16:53:19 -04:00 committed by Miss Islington (bot)
parent e19a91e45f
commit 1cc0ee7d9f
4 changed files with 46 additions and 8 deletions

View file

@ -26,6 +26,7 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
self._transport = None
self._process_exited = False
self._pipe_fds = []
self._stdin_closed = self._loop.create_future()
def __repr__(self):
info = [self.__class__.__name__]
@ -80,6 +81,10 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
if pipe is not None:
pipe.close()
self.connection_lost(exc)
if exc is None:
self._stdin_closed.set_result(None)
else:
self._stdin_closed.set_exception(exc)
return
if fd == 1:
reader = self.stdout
@ -106,6 +111,10 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
self._transport.close()
self._transport = None
def _get_close_waiter(self, stream):
if stream is self.stdin:
return self._stdin_closed
class Process:
def __init__(self, transport, protocol, loop, *, _asyncio_internal=False):