mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
[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 db0c5b786d
)
Co-authored-by: M. Kocher <michael.kocher@me.com>
Co-authored-by: M. Kocher <michael.kocher@me.com>
This commit is contained in:
parent
5df4abd6b0
commit
5a8ddcc452
3 changed files with 19 additions and 22 deletions
|
@ -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] + "...>"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue