[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 e2e6b95c03)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2022-10-06 12:09:50 -07:00 committed by GitHub
parent 1cd19f7ebf
commit bd3dcb3549
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View 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):