[Python-checkins] cpython (3.4): asyncio: Fix repr(BaseSubprocessTransport) if it didn't start yet

victor.stinner python-checkins at python.org
Tue Mar 10 16:35:30 CET 2015


https://hg.python.org/cpython/rev/869eff562b55
changeset:   94930:869eff562b55
branch:      3.4
parent:      94928:12a857e173b7
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Mar 10 16:32:29 2015 +0100
summary:
  asyncio: Fix repr(BaseSubprocessTransport) if it didn't start yet

Replace "running" with "not started" and don't show the pid if the subprocess
didn't start yet.

files:
  Lib/asyncio/base_subprocess.py |  7 +++++--
  1 files changed, 5 insertions(+), 2 deletions(-)


diff --git a/Lib/asyncio/base_subprocess.py b/Lib/asyncio/base_subprocess.py
--- a/Lib/asyncio/base_subprocess.py
+++ b/Lib/asyncio/base_subprocess.py
@@ -54,11 +54,14 @@
         info = [self.__class__.__name__]
         if self._closed:
             info.append('closed')
-        info.append('pid=%s' % self._pid)
+        if self._pid is not None:
+            info.append('pid=%s' % self._pid)
         if self._returncode is not None:
             info.append('returncode=%s' % self._returncode)
+        elif self._pid is not None:
+            info.append('running')
         else:
-            info.append('running')
+            info.append('not started')
 
         stdin = self._pipes.get(0)
         if stdin is not None:

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


More information about the Python-checkins mailing list