@@ -312,6 +312,7 @@ def run_perf(cwd, *args, use_jit=False, **env_vars):
312312 stdout = subprocess .PIPE ,
313313 stderr = subprocess .PIPE ,
314314 env = env ,
315+ text = True ,
315316 )
316317 if proc .returncode :
317318 print (proc .stderr , file = sys .stderr )
@@ -321,10 +322,10 @@ def run_perf(cwd, *args, use_jit=False, **env_vars):
321322 jit_output_file = cwd + "/jit_output.dump"
322323 command = ("perf" , "inject" , "-j" , "-i" , output_file , "-o" , jit_output_file )
323324 proc = subprocess .run (
324- command , stderr = subprocess .PIPE , stdout = subprocess .PIPE , env = env
325+ command , stderr = subprocess .PIPE , stdout = subprocess .PIPE , env = env , text = True
325326 )
326327 if proc .returncode :
327- print (proc .stderr )
328+ print (proc .stderr , file = sys . stderr )
328329 raise ValueError (f"Perf failed with return code { proc .returncode } " )
329330 # Copy the jit_output_file to the output_file
330331 os .rename (jit_output_file , output_file )
@@ -336,10 +337,9 @@ def run_perf(cwd, *args, use_jit=False, **env_vars):
336337 stderr = subprocess .PIPE ,
337338 env = env ,
338339 check = True ,
340+ text = True ,
339341 )
340- return proc .stdout .decode ("utf-8" , "replace" ), proc .stderr .decode (
341- "utf-8" , "replace"
342- )
342+ return proc .stdout , proc .stderr
343343
344344
345345class TestPerfProfilerMixin :
0 commit comments