From: Brian Curtin Date: Fri, 5 Nov 2010 15:40:27 +0000 (+0000) Subject: Fix ResourceWarning from subprocess pipes being left open. X-Git-Tag: v3.2a4~135 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ab747a7daaaaad29b71adff78f50357e35a3cae4;p=python Fix ResourceWarning from subprocess pipes being left open. --- diff --git a/Lib/test/test_quopri.py b/Lib/test/test_quopri.py index 2c52a3c025..583fd456a4 100644 --- a/Lib/test/test_quopri.py +++ b/Lib/test/test_quopri.py @@ -178,6 +178,7 @@ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz''') (p, e) = self.STRINGS[-1] process = subprocess.Popen([sys.executable, "-mquopri"], stdin=subprocess.PIPE, stdout=subprocess.PIPE) + self.addCleanup(process.stdout.close) cout, cerr = process.communicate(p) # On Windows, Python will output the result to stdout using # CRLF, as the mode of stdout is text mode. To compare this @@ -193,6 +194,7 @@ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz''') (p, e) = self.STRINGS[-1] process = subprocess.Popen([sys.executable, "-mquopri", "-d"], stdin=subprocess.PIPE, stdout=subprocess.PIPE) + self.addCleanup(process.stdout.close) cout, cerr = process.communicate(e) cout = cout.decode('latin-1') p = p.decode('latin-1')