diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2019-05-14 21:39:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-14 21:39:13 (GMT) |
commit | 54b74fe9df89f0e5646736f1f60376b4e37c422c (patch) | |
tree | 66a644b3c82f9b967c0e87192aca06979ef31b46 | |
parent | 91c99873d115b9796377d5056785f2abc987520f (diff) | |
download | cpython-54b74fe9df89f0e5646736f1f60376b4e37c422c.zip cpython-54b74fe9df89f0e5646736f1f60376b4e37c422c.tar.gz cpython-54b74fe9df89f0e5646736f1f60376b4e37c422c.tar.bz2 |
bpo-36801: Temporarily fix regression in writer.drain() (#13330)
-rw-r--r-- | Lib/asyncio/streams.py | 4 | ||||
-rw-r--r-- | Lib/test/test_asyncio/test_streams.py | 23 |
2 files changed, 1 insertions, 26 deletions
diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py index 146a338..2f0cbfd 100644 --- a/Lib/asyncio/streams.py +++ b/Lib/asyncio/streams.py @@ -439,9 +439,7 @@ class StreamWriter: # Wait for protocol.connection_lost() call # Raise connection closing error if any, # ConnectionResetError otherwise - fut = self._protocol._get_close_waiter(self) - await fut - raise ConnectionResetError('Connection lost') + await sleep(0) await self._protocol._drain_helper() diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py index 8d6a1d2..258d8a7 100644 --- a/Lib/test/test_asyncio/test_streams.py +++ b/Lib/test/test_asyncio/test_streams.py @@ -109,29 +109,6 @@ class StreamTests(test_utils.TestCase): self._basetest_open_connection_no_loop_ssl(conn_fut) - @unittest.skipIf(ssl is None, 'No ssl module') - def test_drain_on_closed_writer_ssl(self): - - async def inner(httpd): - reader, writer = await asyncio.open_connection( - *httpd.address, - ssl=test_utils.dummy_ssl_context()) - - messages = [] - self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx)) - writer.write(b'GET / HTTP/1.0\r\n\r\n') - data = await reader.read() - self.assertTrue(data.endswith(b'\r\n\r\nTest message')) - - writer.close() - with self.assertRaises(ConnectionResetError): - await writer.drain() - - self.assertEqual(messages, []) - - with test_utils.run_test_server(use_ssl=True) as httpd: - self.loop.run_until_complete(inner(httpd)) - def _basetest_open_connection_error(self, open_connection_fut): messages = [] self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx)) |