[Python-checkins] [3.11] GH-88050: fix race in closing subprocess pipe in asyncio (GH-97951) (#97978)

ambv webhook-mailer at python.org
Thu Oct 6 15:09:56 EDT 2022


https://github.com/python/cpython/commit/bd3dcb3549e9c1c26495bc3cc1a45197079bdcaf
commit: bd3dcb3549e9c1c26495bc3cc1a45197079bdcaf
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: ambv <lukasz at langa.pl>
date: 2022-10-06T12:09:50-07:00
summary:

[3.11] GH-88050: fix race in closing subprocess pipe in asyncio  (GH-97951) (#97978)

Check for None when iterating over `self._pipes.values()`.
(cherry picked from commit e2e6b95c0342247ed1a761b6e149ac579a8722dd)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303 at users.noreply.github.com>

files:
M Lib/asyncio/base_subprocess.py

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 @@ def _process_exited(self, returncode):
             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):



More information about the Python-checkins mailing list