[3.14] gh-114177: avoid calling connection lost callbacks when loop is already closed in asyncio subprocess (GH-134508) (#134561)

gh-114177: avoid calling connection lost callbacks when loop is already closed in asyncio subprocess (GH-134508)
(cherry picked from commit 5804ee7b46)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
Miss Islington (bot) 2025-05-23 06:58:51 +02:00 committed by GitHub
parent 1cdbb33771
commit c67eb41a3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -104,6 +104,11 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
for proto in self._pipes.values():
if proto is None:
continue
# 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

View file

@ -0,0 +1 @@
Fix :mod:`asyncio` to not close subprocess pipes which would otherwise error out when the event loop is already closed.