summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/base_subprocess.py
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-10-06 17:18:19 (GMT)
committerGitHub <noreply@github.com>2022-10-06 17:18:19 (GMT)
commite2e6b95c0342247ed1a761b6e149ac579a8722dd (patch)
tree91635ead8eb11d563dc838444642141db66c73e3 /Lib/asyncio/base_subprocess.py
parentf612565bd32d4ab0945798da775eea070f08b6fe (diff)
downloadcpython-e2e6b95c0342247ed1a761b6e149ac579a8722dd.zip
cpython-e2e6b95c0342247ed1a761b6e149ac579a8722dd.tar.gz
cpython-e2e6b95c0342247ed1a761b6e149ac579a8722dd.tar.bz2
GH-88050: fix race in closing subprocess pipe in asyncio (#97951)
Check for None when iterating over `self._pipes.values()`.
Diffstat (limited to 'Lib/asyncio/base_subprocess.py')
-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):