]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-88050: fix race in closing subprocess pipe in asyncio (#97951)
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Thu, 6 Oct 2022 17:18:19 +0000 (22:48 +0530)
committerGitHub <noreply@github.com>
Thu, 6 Oct 2022 17:18:19 +0000 (10:18 -0700)
Check for None when iterating over `self._pipes.values()`.

Lib/asyncio/base_subprocess.py

index c2ca4a2792f666a5e84f91487ea79ba77de7f8ed..e15bb4141fc02ad39b3c73ac0c49c3b9fd2f871f 100644 (file)
@@ -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):