diff options
| author | Andrey Doroschenko <dorosch.github.io@yandex.ru> | 2019-11-17 17:08:31 +0300 |
|---|---|---|
| committer | Tal Einat <taleinat+github@gmail.com> | 2019-11-17 16:08:31 +0200 |
| commit | 645005e947c13c4a0706310a2a46112bf63cadc0 (patch) | |
| tree | 1df0a27b4be362611a8f4836817961c819d1d277 /Lib/subprocess.py | |
| parent | 143a97f64128070386b12a0ee589bdaad5e51f40 (diff) | |
| download | cpython-git-645005e947c13c4a0706310a2a46112bf63cadc0.tar.gz | |
bpo-38724: Implement subprocess.Popen.__repr__ (GH-17151)
Diffstat (limited to 'Lib/subprocess.py')
| -rw-r--r-- | Lib/subprocess.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py index b5a45d9fea..ba6f1983a5 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -978,6 +978,15 @@ class Popen(object): raise + def __repr__(self): + obj_repr = ( + f"<{self.__class__.__name__}: " + f"returncode: {self.returncode} args: {list(self.args)!r}>" + ) + if len(obj_repr) > 80: + obj_repr = obj_repr[:76] + "...>" + return obj_repr + @property def universal_newlines(self): # universal_newlines as retained as an alias of text_mode for API |
