[issue43776] Popen with shell=True yield mangled repr output

2021-04-23 Thread mkocher


mkocher  added the comment:

There also appears to be an issue when args are provided as a `pathlib.Path` 
instance.


Python 3.9.2 | packaged by conda-forge | (default, Feb 21 2021, 05:02:20) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.22.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from subprocess import Popen

In [2]: from pathlib import Path

In [3]: p = Path('/usr/local/bin/gtrue')

In [4]: x = Popen(p)

In [5]: repr(x)
---
TypeError Traceback (most recent call last)
 in 
> 1 repr(x)

~/opt/miniconda3/envs/core/lib/python3.9/subprocess.py in __repr__(self)
990 obj_repr = (
991 f"<{self.__class__.__name__}: "
--> 992 f"returncode: {self.returncode} args: {list(self.args)!r}>"
993 )
994 if len(obj_repr) > 80:

TypeError: 'PosixPath' object is not iterable

--

___
Python tracker 
<https://bugs.python.org/issue43776>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43776] Popen with shell=True yield mangled repr output

2021-04-23 Thread mkocher


mkocher  added the comment:

There's a PR up with removed `list` call as well as improved test coverage for 
the case where args is passed into Popen as a string. 

Hopefully this can get merged before things starting getting crazy with the 
3.10 release crunch.

--

___
Python tracker 
<https://bugs.python.org/issue43776>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43776] Popen with shell=True yield mangled repr output

2021-04-10 Thread mkocher


Change by mkocher :


--
keywords: +patch
pull_requests: +24073
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25338

___
Python tracker 
<https://bugs.python.org/issue43776>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43776] Popen with shell=True yield mangled repr output

2021-04-08 Thread mkocher


New submission from mkocher :

When using Popen with shell=True, the output of the repr is not particularly 
user friendly. 

When using the form `p = Popen('python --version'.split())`, the output is 
reasonably output in a user friendly form of ``. 

However, when running with `shell=True`, the output is mangled.

For example, trying to run `python --help` via `p = Popen('python --version', 
shell=True)` yields the following output.

``

The original change appears to be motivated by 
https://bugs.python.org/issue38724 

and the PR here:

https://github.com/python/cpython/pull/17151/files

--
components: Library (Lib)
messages: 390542
nosy: mkocher
priority: normal
severity: normal
status: open
title: Popen with shell=True yield mangled repr output
type: behavior
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue43776>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com