From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sat, 26 Jul 2025 17:28:40 +0000 (+0200) Subject: [3.14] gh-131038: Use text=True in subprocesses in test_perf_profiler (GH-137117... X-Git-Tag: v3.14.0rc2~50 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fc911a93cbeda70a5282461ac4793b30129621b8;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-131038: Use text=True in subprocesses in test_perf_profiler (GH-137117) (#137124) --- diff --git a/Lib/test/test_perf_profiler.py b/Lib/test/test_perf_profiler.py index 7529c853f9c1..0207843cc0e8 100644 --- a/Lib/test/test_perf_profiler.py +++ b/Lib/test/test_perf_profiler.py @@ -318,6 +318,7 @@ def run_perf(cwd, *args, use_jit=False, **env_vars): stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env, + text=True, ) if proc.returncode: print(proc.stderr, file=sys.stderr) @@ -327,10 +328,10 @@ def run_perf(cwd, *args, use_jit=False, **env_vars): jit_output_file = cwd + "/jit_output.dump" command = ("perf", "inject", "-j", "-i", output_file, "-o", jit_output_file) proc = subprocess.run( - command, stderr=subprocess.PIPE, stdout=subprocess.PIPE, env=env + command, stderr=subprocess.PIPE, stdout=subprocess.PIPE, env=env, text=True ) if proc.returncode: - print(proc.stderr) + print(proc.stderr, file=sys.stderr) raise ValueError(f"Perf failed with return code {proc.returncode}") # Copy the jit_output_file to the output_file os.rename(jit_output_file, output_file) @@ -342,10 +343,9 @@ def run_perf(cwd, *args, use_jit=False, **env_vars): stderr=subprocess.PIPE, env=env, check=True, + text=True, ) - return proc.stdout.decode("utf-8", "replace"), proc.stderr.decode( - "utf-8", "replace" - ) + return proc.stdout, proc.stderr class TestPerfProfilerMixin: