mirror of
https://github.com/python/cpython.git
synced 2025-08-23 10:16:01 +00:00
bpo-36801: Temporarily fix regression in writer.drain() (#13330)
This commit is contained in:
parent
91c99873d1
commit
54b74fe9df
2 changed files with 1 additions and 26 deletions
|
@ -439,9 +439,7 @@ class StreamWriter:
|
||||||
# Wait for protocol.connection_lost() call
|
# Wait for protocol.connection_lost() call
|
||||||
# Raise connection closing error if any,
|
# Raise connection closing error if any,
|
||||||
# ConnectionResetError otherwise
|
# ConnectionResetError otherwise
|
||||||
fut = self._protocol._get_close_waiter(self)
|
await sleep(0)
|
||||||
await fut
|
|
||||||
raise ConnectionResetError('Connection lost')
|
|
||||||
await self._protocol._drain_helper()
|
await self._protocol._drain_helper()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -109,29 +109,6 @@ class StreamTests(test_utils.TestCase):
|
||||||
|
|
||||||
self._basetest_open_connection_no_loop_ssl(conn_fut)
|
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):
|
def _basetest_open_connection_error(self, open_connection_fut):
|
||||||
messages = []
|
messages = []
|
||||||
self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx))
|
self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue