mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.13] gh-131038: Use text=True in subprocesses in test_perf_profiler (GH-137117) (#137125)
This commit is contained in:
parent
8f4121168a
commit
a995a11b23
1 changed files with 5 additions and 5 deletions
|
|
@ -312,6 +312,7 @@ def run_perf(cwd, *args, use_jit=False, **env_vars):
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
env=env,
|
env=env,
|
||||||
|
text=True,
|
||||||
)
|
)
|
||||||
if proc.returncode:
|
if proc.returncode:
|
||||||
print(proc.stderr, file=sys.stderr)
|
print(proc.stderr, file=sys.stderr)
|
||||||
|
|
@ -321,10 +322,10 @@ def run_perf(cwd, *args, use_jit=False, **env_vars):
|
||||||
jit_output_file = cwd + "/jit_output.dump"
|
jit_output_file = cwd + "/jit_output.dump"
|
||||||
command = ("perf", "inject", "-j", "-i", output_file, "-o", jit_output_file)
|
command = ("perf", "inject", "-j", "-i", output_file, "-o", jit_output_file)
|
||||||
proc = subprocess.run(
|
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:
|
if proc.returncode:
|
||||||
print(proc.stderr)
|
print(proc.stderr, file=sys.stderr)
|
||||||
raise ValueError(f"Perf failed with return code {proc.returncode}")
|
raise ValueError(f"Perf failed with return code {proc.returncode}")
|
||||||
# Copy the jit_output_file to the output_file
|
# Copy the jit_output_file to the output_file
|
||||||
os.rename(jit_output_file, output_file)
|
os.rename(jit_output_file, output_file)
|
||||||
|
|
@ -336,10 +337,9 @@ def run_perf(cwd, *args, use_jit=False, **env_vars):
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
env=env,
|
env=env,
|
||||||
check=True,
|
check=True,
|
||||||
|
text=True,
|
||||||
)
|
)
|
||||||
return proc.stdout.decode("utf-8", "replace"), proc.stderr.decode(
|
return proc.stdout, proc.stderr
|
||||||
"utf-8", "replace"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class TestPerfProfilerMixin:
|
class TestPerfProfilerMixin:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue