diff options
author | Gregory P. Smith <greg@krypto.org> | 2021-06-02 21:15:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-02 21:15:26 -0700 |
commit | 5a8ddcc4524dca3880d7fc2818814ffae1cfb8a2 (patch) | |
tree | dd41018682a99af6c4725af4c97f63aa67138db1 /Lib/subprocess.py | |
parent | 5df4abd6b033a5f1e48945c6988b45e35e76f647 (diff) | |
download | cpython-git-5a8ddcc4524dca3880d7fc2818814ffae1cfb8a2.tar.gz |
[3.9] bpo-43776: Remove list call from args in Popen repr (GH-25338) (GH-26510)
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.
(cherry picked from commit db0c5b786df961785ae8c803f5572ae0c8dadcc7)
Co-authored-by: M. Kocher <michael.kocher@me.com>
Co-authored-by: M. Kocher <michael.kocher@me.com>
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 0311e3a1f8..4effc1d8b3 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -989,7 +989,7 @@ class Popen(object): 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] + "...>" |