summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-10-06 19:09:50 (GMT)
committerGitHub <noreply@github.com>2022-10-06 19:09:50 (GMT)
commitbd3dcb3549e9c1c26495bc3cc1a45197079bdcaf (patch)
tree1c01d9c7310f17f6447981d135cfd0aaaf88767f
parent1cd19f7ebfc2df2f4052e5dba0d548c4eb9caa45 (diff)
downloadcpython-bd3dcb3549e9c1c26495bc3cc1a45197079bdcaf.zip
cpython-bd3dcb3549e9c1c26495bc3cc1a45197079bdcaf.tar.gz
cpython-bd3dcb3549e9c1c26495bc3cc1a45197079bdcaf.tar.bz2
[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@users.noreply.github.com>
-rw-r--r--Lib/asyncio/base_subprocess.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/asyncio/base_subprocess.py b/Lib/asyncio/base_subprocess.py
index c2ca4a2..e15bb41 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):