summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/proactor_events.py
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-10-24 20:21:42 (GMT)
committerGitHub <noreply@github.com>2022-10-24 20:21:42 (GMT)
commitad1dc3ebb6aadaeeeacde13d4ed2d62bf302bf62 (patch)
treee52f65e2e56d35c0b7901578527c054f8fc62bf7 /Lib/asyncio/proactor_events.py
parente3b9dd8e870a61016e0f221e30d4f7d0b99cddb3 (diff)
downloadcpython-ad1dc3ebb6aadaeeeacde13d4ed2d62bf302bf62.zip
cpython-ad1dc3ebb6aadaeeeacde13d4ed2d62bf302bf62.tar.gz
cpython-ad1dc3ebb6aadaeeeacde13d4ed2d62bf302bf62.tar.bz2
GH-89237: fix hang in proactor `subprocess.wait_closed()` (#98572)
Diffstat (limited to 'Lib/asyncio/proactor_events.py')
-rw-r--r--Lib/asyncio/proactor_events.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
index ddb9dac..2685a33 100644
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -60,6 +60,7 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin,
self._pending_write = 0
self._conn_lost = 0
self._closing = False # Set when close() called.
+ self._called_connection_lost = False
self._eof_written = False
if self._server is not None:
self._server._attach()
@@ -136,7 +137,7 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin,
self._empty_waiter.set_result(None)
else:
self._empty_waiter.set_exception(exc)
- if self._closing:
+ if self._closing and self._called_connection_lost:
return
self._closing = True
self._conn_lost += 1
@@ -166,6 +167,7 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin,
if server is not None:
server._detach()
self._server = None
+ self._called_connection_lost = True
def get_write_buffer_size(self):
size = self._pending_write