bpo-36801: Temporarily fix regression in writer.drain() (#13330) · python/cpython@54b74fe (original) (raw)

2 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -439,9 +439,7 @@ async def drain(self):
439 439 # Wait for protocol.connection_lost() call
440 440 # Raise connection closing error if any,
441 441 # ConnectionResetError otherwise
442 -fut = self._protocol._get_close_waiter(self)
443 -await fut
444 -raise ConnectionResetError('Connection lost')
442 +await sleep(0)
445 443 await self._protocol._drain_helper()
446 444
447 445
Original file line number Diff line number Diff line change
@@ -109,29 +109,6 @@ def test_open_unix_connection_no_loop_ssl(self):
109 109
110 110 self._basetest_open_connection_no_loop_ssl(conn_fut)
111 111
112 -@unittest.skipIf(ssl is None, 'No ssl module')
113 -def test_drain_on_closed_writer_ssl(self):
114 -
115 -async def inner(httpd):
116 -reader, writer = await asyncio.open_connection(
117 -*httpd.address,
118 -ssl=test_utils.dummy_ssl_context())
119 -
120 -messages = []
121 -self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx))
122 -writer.write(b'GET / HTTP/1.0\r\n\r\n')
123 -data = await reader.read()
124 -self.assertTrue(data.endswith(b'\r\n\r\nTest message'))
125 -
126 -writer.close()
127 -with self.assertRaises(ConnectionResetError):
128 -await writer.drain()
129 -
130 -self.assertEqual(messages, [])
131 -
132 -with test_utils.run_test_server(use_ssl=True) as httpd:
133 -self.loop.run_until_complete(inner(httpd))
134 -
135 112 def _basetest_open_connection_error(self, open_connection_fut):
136 113 messages = []
137 114 self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx))