]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43826: Fix resource warning due to unclosed objects. (GH-25381)
authorKarthikeyan Singaravelan <tir.karthi@gmail.com>
Tue, 24 Aug 2021 10:43:46 +0000 (16:13 +0530)
committerGitHub <noreply@github.com>
Tue, 24 Aug 2021 10:43:46 +0000 (16:13 +0530)
Lib/test/test_subprocess.py

index f0f0e6f6069da7f9ac2f8bb4f2dffda758d9f938..94a95c7a00bf20e316bed7a15e4b47e0352c6d6f 100644 (file)
@@ -719,6 +719,8 @@ class ProcessTestCase(BaseTestCase):
             # However, this function is not yet in _winapi.
             p.stdin.write(b"pear")
             p.stdin.close()
+            p.stdout.close()
+            p.stderr.close()
         finally:
             p.kill()
             p.wait()
@@ -746,6 +748,8 @@ class ProcessTestCase(BaseTestCase):
             # On other platforms we cannot test the pipe size (yet). But above
             # code using pipesize=-1 should not crash.
             p.stdin.close()
+            p.stdout.close()
+            p.stderr.close()
         finally:
             p.kill()
             p.wait()
@@ -3243,6 +3247,7 @@ class POSIXProcessTestCase(BaseTestCase):
         with mock.patch.object(p, 'poll', new=lambda: None):
             p.returncode = None
             p.send_signal(signal.SIGTERM)
+        p.kill()
 
     def test_communicate_repeated_call_after_stdout_close(self):
         proc = subprocess.Popen([sys.executable, '-c',