_pth_file = os.path.splitext(exe_file)[0] + '._pth'
else:
_pth_file = os.path.splitext(dll_file)[0] + '._pth'
- with open(_pth_file, 'w') as f:
+ with open(_pth_file, 'w', encoding='utf8') as f:
for line in lines:
print(line, file=f)
return exe_file
os.path.dirname(exe_file),
pth_lines)
- output = subprocess.check_output([exe_file, '-c',
+ output = subprocess.check_output([exe_file, '-X', 'utf8', '-c',
'import sys; print("\\n".join(sys.path) if sys.flags.no_site else "")'
], encoding='utf-8', errors='surrogateescape')
actual_sys_path = output.rstrip().split('\n')
--- /dev/null
+Fix ``test_site.test_underpth_basic()`` when the working directory contains
+at least one non-ASCII character: encode the ``._pth`` file to UTF-8 and
+enable the UTF-8 Mode to use UTF-8 for the child process stdout. Patch by
+Victor Stinner.