[Python-checkins] bpo-43826: Fix resource warning due to unclosed objects. (GH-25381)

tirkarthi webhook-mailer at python.org
Tue Aug 24 06:44:19 EDT 2021


https://github.com/python/cpython/commit/7179930ab5f5b2dea039023bec968aadc03e3775
commit: 7179930ab5f5b2dea039023bec968aadc03e3775
branch: main
author: Karthikeyan Singaravelan <tir.karthi at gmail.com>
committer: tirkarthi <tir.karthi at gmail.com>
date: 2021-08-24T16:13:46+05:30
summary:

bpo-43826: Fix resource warning due to unclosed objects. (GH-25381)

files:
M Lib/test/test_subprocess.py

diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index f0f0e6f6069da..94a95c7a00bf2 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -719,6 +719,8 @@ def test_pipesizes(self):
             # 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 @@ def test_pipesize_default(self):
             # 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 @@ def test_send_signal_race2(self):
         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',



More information about the Python-checkins mailing list