1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
$NetBSD: patch-CVE-2012-1150-Lib_test_test_support.py,v 1.1 2012/03/25 09:09:05 tron Exp $
Fix for CVE-2012-1150 taken from here:
http://hg.python.org/cpython/rev/6b7704fe1be1
--- Lib/test/test_support.py.orig 2010-08-02 23:01:34.000000000 +0100
+++ Lib/test/test_support.py 2012-03-25 09:51:50.000000000 +0100
@@ -24,7 +24,7 @@
"captured_stdout", "TransientResource", "transient_internet",
"run_with_locale", "set_memlimit", "bigmemtest", "bigaddrspacetest",
"BasicTestRunner", "run_unittest", "run_doctest", "threading_setup",
- "threading_cleanup", "reap_children"]
+ "threading_cleanup", "reap_children", "strip_python_stderr"]
class Error(Exception):
"""Base class for regression test exceptions."""
@@ -893,3 +893,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
|