[Python-Dev] Unicode Imports

Nick Coghlan ncoghlan at gmail.com
Sun Sep 10 04:24:38 CEST 2006


David Hopwood wrote:
> Martin v. Löwis wrote:
>> Programs that rely on sys.getfilesystemencoding() being able to
>> represent arbitrary file names on Windows might have a bug;
>> programs that rely on sys.getfilesystemencoding() being able
>> to encode all elements of sys.path do not (at least not for
>> Python 2.5 and earlier).
> 
> Elements of sys.path can be Unicode strings in Python 2.5, and should be
> pathnames supported by the underlying OS. Where is it documented that there
> is any further restriction on them? And why should there be any further
> restriction on them?

There's no suggestion that this limitation shouldn't be fixed - merely that 
fixing it is likely to break some applications which rely on sys.path for 
importing or introspection purposes. A 2.5.x maintenance release typically 
shouldn't break anything that worked correctly on 2.5.0, hence fixing this 
becomes a project for either 2.6 or 3.0.

To put it another way: fixing this is likely to require changes to more than 
just the interpreter core. It will also potentially require changes to all 
applications which currently expect to be able to use 
's.encode(sys.getfilesystemencoding())' to convert any Unicode path entry or 
__file__ attribute to an 8-bit string.

Doing that qualifies as correcting a language design error or limitation, but 
it would require a real stretch of the definition to qualify as a bug fix.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list