File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -556,12 +556,21 @@ def adjust_rlimit_nofile():
556556
557557
558558def display_header ():
559+ encoding = sys .stdout .encoding
560+
559561 # Print basic platform information
560562 print ("==" , platform .python_implementation (), * sys .version .split ())
561563 print ("==" , platform .platform (aliased = True ),
562564 "%s-endian" % sys .byteorder )
563565 print ("== Python build:" , ' ' .join (get_build_info ()))
564- print ("== cwd:" , os .getcwd ())
566+
567+ cwd = os .getcwd ()
568+ # gh-109508: support.os_helper.FS_NONASCII, used by get_work_dir(), cannot
569+ # be encoded to the filesystem encoding on purpose, escape non-encodable
570+ # characters with backslashreplace error handler.
571+ formatted_cwd = cwd .encode (encoding , "backslashreplace" ).decode (encoding )
572+ print ("== cwd:" , formatted_cwd )
573+
565574 cpu_count = os .cpu_count ()
566575 if cpu_count :
567576 print ("== CPU count:" , cpu_count )
You can’t perform that action at this time.
0 commit comments