◐ Shell
clean mode source ↗

Message 124650 - Python tracker

Le samedi 25 décembre 2010 à 22:35 +0000, Éric Araujo a écrit :
> Victor: Your patch uses os.fsencode, so porting to distutils2 won’t be
> easy.

In Python 3.1, you can replace name=os.fsencode(name) by
name=name.encode(sys.getfilesystemencoding(), 'surrogateescape'). The
mbcs codec doesn't support surrogateescape. In Python 3.2 it does now
raise an error (and so os.fsencode() uses strict error handler if the
encoding is mbcs), whereas Python 3.1 just ignores the error handler (it
uses 'ignore' to encode).

In Python 2, self.executable is already a byte string (you don't need
os.fsencode()).