From: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Date: Thu, 6 Oct 2022 17:18:19 +0000 (+0530) Subject: GH-88050: fix race in closing subprocess pipe in asyncio (#97951) X-Git-Tag: v3.12.0a1~222 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e2e6b95c0342247ed1a761b6e149ac579a8722dd;p=thirdparty%2FPython%2Fcpython.git GH-88050: fix race in closing subprocess pipe in asyncio (#97951) Check for None when iterating over `self._pipes.values()`. --- diff --git a/Lib/asyncio/base_subprocess.py b/Lib/asyncio/base_subprocess.py index c2ca4a2792f6..e15bb4141fc0 100644 --- a/Lib/asyncio/base_subprocess.py +++ b/Lib/asyncio/base_subprocess.py @@ -216,7 +216,9 @@ class BaseSubprocessTransport(transports.SubprocessTransport): self._proc.returncode = returncode self._call(self._protocol.process_exited) for p in self._pipes.values(): - p.pipe.close() + if p is not None: + p.pipe.close() + self._try_finish() async def _wait(self):