Index: Lib/test/script_helper.py =================================================================== --- Lib/test/script_helper.py (revision 87048) +++ Lib/test/script_helper.py (working copy) @@ -3,6 +3,7 @@ import sys import os +import re import os.path import tempfile import subprocess @@ -14,6 +15,10 @@ from imp import source_from_cache from test.support import make_legacy_pyc +_refcount = re.compile(br"^\[[0-9]+ refs\]\n", flags=re.MULTILINE) +def _remove_refcount(s): + return _refcount.sub(b'', s) + # Executing the interpreter in a subprocess def _assert_python(expected_success, *args, **env_vars): cmd_line = [sys.executable] @@ -34,6 +39,7 @@ p.stdout.close() p.stderr.close() rc = p.returncode + err = _remove_refcount(err) if (rc and expected_success) or (not rc and not expected_success): raise AssertionError( "Process return code is %d, "