mirror of
https://github.com/python/cpython.git
synced 2025-10-02 21:25:24 +00:00
gh-114177: avoid calling connection lost callbacks when loop is already closed in asyncio subprocess (#134508)
This commit is contained in:
parent
8dbc119719
commit
5804ee7b46
2 changed files with 7 additions and 1 deletions
|
@ -104,7 +104,12 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
|
||||||
for proto in self._pipes.values():
|
for proto in self._pipes.values():
|
||||||
if proto is None:
|
if proto is None:
|
||||||
continue
|
continue
|
||||||
proto.pipe.close()
|
# See gh-114177
|
||||||
|
# skip closing the pipe if loop is already closed
|
||||||
|
# this can happen e.g. when loop is closed immediately after
|
||||||
|
# process is killed
|
||||||
|
if self._loop and not self._loop.is_closed():
|
||||||
|
proto.pipe.close()
|
||||||
|
|
||||||
if (self._proc is not None and
|
if (self._proc is not None and
|
||||||
# has the child process finished?
|
# has the child process finished?
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Fix :mod:`asyncio` to not close subprocess pipes which would otherwise error out when the event loop is already closed.
|
Loading…
Add table
Add a link
Reference in a new issue