mirror of
https://github.com/python/cpython.git
synced 2025-09-08 01:41:19 +00:00
Factor out stripping of interpreter debug output in test.support.strip_python_stderr()
This commit is contained in:
parent
f96482e91a
commit
62f68ed31f
3 changed files with 13 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue