[issue8513] subprocess: support bytes program name (POSIX)

STINNER Victor report at bugs.python.org
Mon May 17 01:14:56 CEST 2010


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

I asked on #python-dev about os.get_exec_path() result type. As expected, the answer was "It's a really bad idea".

So here is a new version of my patch. Summary of the patch version 4:
 - subprocess.Popen() and os._execvpe() support bytes program name
 - os.get_exec_path() now supports b'PATH' key and bytes value
 - add os.supports_bytes_environ flag: "True if the native OS type of the environment is bytes (eg. False on Windows)"

Changes since the version 3:
 - document the new os.supports_bytes_environ flag
 - os.get_exec_path() result type is always str (decode bytes to str using sys.getfilesystemencoding() + surrogateescape)
 - path.supports_unicode_filenames is False on Windows 9x but Windows 9x native type is unicode and so fsencode() should not be defined on this OS: revert the fsencode() test (if not path.supports_unicode_filenames => if name != 'nt')

----------
Added file: http://bugs.python.org/file17376/subprocess_bytes_program-4.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8513>
_______________________________________


More information about the Python-bugs-list mailing list