diff options
Diffstat (limited to 'Lib/test/support.py')
-rw-r--r-- | Lib/test/support.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py index 558fbc2..0372f16 100644 --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -1243,3 +1243,13 @@ def swap_item(obj, item, new_val): yield finally: del obj[item] + +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 |