From 1ed43b2da7113a6999830223374e3557ff44ea16 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Thu, 13 Feb 2025 13:23:49 +0000 Subject: [PATCH] gh-130080: return in finally in subprocess.py --- Lib/subprocess.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 2044d2a42897e9..1948ac8a3a1dfe 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1123,10 +1123,9 @@ def __exit__(self, exc_type, value, traceback): except TimeoutExpired: pass self._sigint_wait_secs = 0 # Note that this has been done. - return # resume the KeyboardInterrupt - - # Wait for the process to terminate, to avoid zombies. - self.wait() + else: + # Wait for the process to terminate, to avoid zombies. + self.wait() def __del__(self, _maxsize=sys.maxsize, _warn=warnings.warn): if not self._child_created: