Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a82afe

Browse files
committed
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.
1 parent 84c717d commit 7a82afe

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Lib/asyncio/base_subprocess.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,14 @@ def __repr__(self):
5454
info = [self.__class__.__name__]
5555
if self._closed:
5656
info.append('closed')
57-
info.append('pid=%s' % self._pid)
57+
if self._pid is not None:
58+
info.append('pid=%s' % self._pid)
5859
if self._returncode is not None:
5960
info.append('returncode=%s' % self._returncode)
60-
else:
61+
elif self._pid is not None:
6162
info.append('running')
63+
else:
64+
info.append('not started')
6265

6366
stdin = self._pipes.get(0)
6467
if stdin is not None:

0 commit comments

Comments
 (0)