cpython: 7a3f3ad83676 (original) (raw)

Mercurial > cpython

changeset 70048:7a3f3ad83676

- Issue #12044: Fixed subprocess.Popen when used as a context manager to wait for the process to end when exiting the context to avoid unintentionally leaving zombie processes around. [#12044]

Gregory P. Smith greg@krypto.org
date Wed, 11 May 2011 21:42:08 -0700
parents eb1b93fd68f5
children 361f87c8f36a
files Doc/library/subprocess.rst Lib/subprocess.py Lib/test/test_subprocess.py Misc/NEWS
diffstat 4 files changed, 10 insertions(+), 3 deletions(-)[+] [-] Doc/library/subprocess.rst 4 Lib/subprocess.py 2 Lib/test/test_subprocess.py 3 Misc/NEWS 4

line wrap: on

line diff

--- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -219,8 +219,8 @@ This module defines one class called :cl creationflags, if given, can be :data:CREATE_NEW_CONSOLE or :data:CREATE_NEW_PROCESS_GROUP. (Windows only)

--- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -796,6 +796,8 @@ class Popen(object): self.stderr.close() if self.stdin: self.stdin.close()

def del(self, _maxsize=sys.maxsize, _active=_active): if not self._child_created:

--- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -1590,7 +1590,8 @@ class ContextManagerTests(ProcessTestCas def test_returncode(self): with subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(100)"]) as proc:

def test_communicate_stdin(self):

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ What's New in Python 3.3 Alpha 1? Core and Builtins ----------------- +- Issue #12044: Fixed subprocess.Popen when used as a context manager to