diff options
author | Andrey Doroschenko <dorosch.github.io@yandex.ru> | 2019-11-17 14:08:31 (GMT) |
---|---|---|
committer | Tal Einat <taleinat+github@gmail.com> | 2019-11-17 14:08:31 (GMT) |
commit | 645005e947c13c4a0706310a2a46112bf63cadc0 (patch) | |
tree | 1df0a27b4be362611a8f4836817961c819d1d277 /Lib/subprocess.py | |
parent | 143a97f64128070386b12a0ee589bdaad5e51f40 (diff) | |
download | cpython-645005e947c13c4a0706310a2a46112bf63cadc0.zip cpython-645005e947c13c4a0706310a2a46112bf63cadc0.tar.gz cpython-645005e947c13c4a0706310a2a46112bf63cadc0.tar.bz2 |
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 b5a45d9..ba6f198 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 |