mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
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
This commit is contained in:
parent
f9bedb630e
commit
db0c5b786d
3 changed files with 19 additions and 22 deletions
|
@ -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] + "...>"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue