From: Victor Stinner Date: Tue, 10 Mar 2015 15:32:29 +0000 (+0100) Subject: asyncio: Fix repr(BaseSubprocessTransport) if it didn't start yet X-Git-Tag: v3.5.0a3~210^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7a82afee70425782d27f4ed2c6d0bad3aeb91f09;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Lib/asyncio/base_subprocess.py b/Lib/asyncio/base_subprocess.py index c1cdfda75449..d18f3e8f07c2 100644 --- a/Lib/asyncio/base_subprocess.py +++ b/Lib/asyncio/base_subprocess.py @@ -54,11 +54,14 @@ class BaseSubprocessTransport(transports.SubprocessTransport): 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) - else: + elif self._pid is not None: info.append('running') + else: + info.append('not started') stdin = self._pipes.get(0) if stdin is not None: