Mercurial > cpython-lru_cache-weakref
diff Lib/test/support.py @ 67311:e9a51d463579 3.1
Merged revisions 87695 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r87695 | antoine.pitrou | 2011-01-03 19:23:55 +0100 (lun., 03 janv. 2011) | 5 lines
Issue #10806, issue #9905: Fix subprocess pipes when some of the standard
file descriptors (0, 1, 2) are closed in the parent process. Initial
patch by Ross Lagerwall.
........
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Mon, 03 Jan 2011 18:36:36 +0000 |
| parents | b83f0a667e7c |
| children | abe201dfd3dc |
line wrap: on
line diff
--- a/Lib/test/support.py Mon Jan 03 17:53:13 2011 +0000 +++ b/Lib/test/support.py Mon Jan 03 18:36:36 2011 +0000 @@ -10,6 +10,7 @@ import socket import sys import os +import re import platform import shutil import warnings @@ -1056,3 +1057,13 @@ break except: break + +def strip_python_stderr(stderr): + """Strip the stderr of a Python process from potential debug output + emitted by the interpreter. + + This will typically be run on the result of the communicate() method + of a subprocess.Popen object. + """ + stderr = re.sub(br"\[\d+ refs\]\r?\n?$", b"", stderr).strip() + return stderr
