diff options
author | M. Kocher <michael.kocher@me.com> | 2021-04-28 08:16:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-28 08:16:38 (GMT) |
commit | db0c5b786df961785ae8c803f5572ae0c8dadcc7 (patch) | |
tree | 5af87d347bf4a64b2266d04346a74ce2931d755a /Lib/subprocess.py | |
parent | f9bedb630e8a0b7d94e1c7e609b20dfaa2b22231 (diff) | |
download | cpython-db0c5b786df961785ae8c803f5572ae0c8dadcc7.zip cpython-db0c5b786df961785ae8c803f5572ae0c8dadcc7.tar.gz cpython-db0c5b786df961785ae8c803f5572ae0c8dadcc7.tar.bz2 |
bpo-43776: Remove list call from args in Popen repr (GH-25338)
Removes the `list` call in the Popen `repr`.
Current implementation:
For cmd = `python --version`, with `shell=True`.
```bash
<Popen: returncode: None args: ['p', 'y', 't', 'h', 'o', 'n', ' ', '-', '-',...>
```
For `shell=False` and args=`['python', '--version']`, the output is correct:
```bash
<Popen: returncode: None args: ['python', '--version']>
```
With the new changes the `repr` yields:
For cmd = `python --version`, with `shell=True`:
```bash
<Popen: returncode: None args: 'python --version'>
```
For `shell=False` and args=`['python', '--version']`, the output:
```bash
<Popen: returncode: None args: ['python', '--version']>
```
Automerge-Triggered-By: GH:gpshead
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r-- | Lib/subprocess.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 2b78549..8203ade 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1003,7 +1003,7 @@ class Popen: def __repr__(self): obj_repr = ( f"<{self.__class__.__name__}: " - f"returncode: {self.returncode} args: {list(self.args)!r}>" + f"returncode: {self.returncode} args: {self.args!r}>" ) if len(obj_repr) > 80: obj_repr = obj_repr[:76] + "...>" |