diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2025-05-23 04:58:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-23 04:58:51 (GMT) |
commit | c67eb41a3be8195e411da305246d7915a3ba960e (patch) | |
tree | 4b7307dbf6559e5c2a97996c9fbb7ad7971aa8ef /Lib/asyncio/base_subprocess.py | |
parent | 1cdbb33771f737968f73b4e8bdce04551db1a417 (diff) | |
download | cpython-c67eb41a3be8195e411da305246d7915a3ba960e.zip cpython-c67eb41a3be8195e411da305246d7915a3ba960e.tar.gz cpython-c67eb41a3be8195e411da305246d7915a3ba960e.tar.bz2 |
[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 5804ee7b467d86131be3ff7d569443efb0d0f9fd)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Diffstat (limited to 'Lib/asyncio/base_subprocess.py')
-rw-r--r-- | Lib/asyncio/base_subprocess.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/asyncio/base_subprocess.py b/Lib/asyncio/base_subprocess.py index 9c2ba67..d40af42 100644 --- a/Lib/asyncio/base_subprocess.py +++ b/Lib/asyncio/base_subprocess.py @@ -104,7 +104,12 @@ class BaseSubprocessTransport(transports.SubprocessTransport): for proto in self._pipes.values(): if proto is None: 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 # has the child process finished? |