[Python-checkins] cpython: Include the timeout value in TimeoutExpired. (original) (raw)

reid.kleckner python-checkins at python.org
Wed Mar 16 22:10:02 CET 2011


http://hg.python.org/cpython/rev/a161081e8f7c changeset: 68618:a161081e8f7c parent: 68611:6b627e121573 user: Reid Kleckner <reid at kleckner.net> date: Wed Mar 16 16:57:54 2011 -0400 summary: Include the timeout value in TimeoutExpired.

This was the original intention, but it wasn't threaded all the way through due to 'endtime'. Also added a trivial assertion to get coverage of str.

files: Lib/subprocess.py Lib/test/test_subprocess.py

diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -371,8 +371,9 @@ """This exception is raised when the timeout expires while waiting for a child process. """

@@ -533,7 +534,7 @@ except TimeoutExpired: process.kill() output, unused_err = process.communicate()

@@ -844,7 +845,7 @@ return (stdout, stderr)

     try:

@@ -865,12 +866,12 @@ return endtime - time.time()

@@ -1063,9 +1064,11 @@ return self.returncode

@@ -1073,7 +1076,7 @@ if self.returncode is None: result = _subprocess.WaitForSingleObject(self._handle, timeout) if result == _subprocess.WAIT_TIMEOUT:

@@ -1083,7 +1086,7 @@ fh.close()

@@ -1489,13 +1492,18 @@ def wait(self, timeout=None, endtime=None): """Wait for child process to terminate. Returns returncode attribute."""

@@ -1507,7 +1515,7 @@ break remaining = self._remaining_time(endtime) if remaining <= 0:

@@ -1516,7 +1524,7 @@ return self.returncode

@@ -1525,9 +1533,11 @@ self.stdin.close()

         if _has_poll:

@@ -1550,7 +1560,7 @@ return (stdout, stderr)

@@ -1601,7 +1611,7 @@ if e.args[0] == errno.EINTR: continue raise

@@ -1625,7 +1635,7 @@ return (stdout, stderr)

@@ -1667,9 +1677,9 @@ # According to the docs, returning three empty lists indicates # that the timeout expired. if not (rlist or wlist or xlist):

diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -651,7 +651,9 @@ def test_wait_timeout(self): p = subprocess.Popen([sys.executable, "-c", "import time; time.sleep(0.1)"])

-- Repository URL: http://hg.python.org/cpython



More information about the Python-checkins mailing list