[Python-Dev] test_pep277 vs Win98

Tim Peters tim.one@comcast.net
Sat, 05 Oct 2002 18:17:31 -0400


[martin@v.loewis.de]
> If you take this definition, it will be very difficult to determine
> whether this should be True or False on Unix. On some systems, it will
> depend on environment variables whether these are valid file names or
> not.

Then set it to False without thinking on Unix, until Unix systems evolve to
the point where Unicode strings are generally useful file paths.

> Also, the test tests whether os.listdir(u".") returns Unicode file
> names - which is currently never the case on Unix, even though they
> may support the file names as arguments. So should I add
> os.path.listdir_with_unicode_argument_returns_unicode as well?

I would consider that more unhelpul logic-chopping <wink>.  I would hope
that intuitive listdir() behavior was part of what it *means* for Unicode
strings to be generally useful as file paths.  If no version of Unix
supports that (yet), fine, then no version of Unix can (yet) claim
supports_unicode_filenames in this sense.

> Furthermore, how would I implement os.path.supports_unicode_filenames
> for ntpath? It seems that something must be exported from os.

This sounds like, for now, whether a platform supports this or not is a
matter of hand-forcing a config symbol, where only a few Windows flavors are
currently justified in saying "yup, works here".

> ...
> PEP 277 gives Python applications access to all file names on Windows
> NT; this is a property unique to NT: on all other systems, you can
> access all file names using byte strings. For the test to test that
> feature, we need to chose a set of file names that are cannot all be
> represented as byte strings, simultaneously.

I still see nothing specific to Windows in this, apart from that NT+ appear
to be, for now, the only OSes that support Unicode strings as file paths in
a generally useful way.  The crux of PEP 277 from my POV is not that Windows
supports this, but that some flavors of Windows allow "direct access to all
file names, including those that are not representable using the current
locale", and using Unicode.  That's a Good Idea, and I doubt Microsoft has a
patent on it.  The PEP also mentions that it seems *plausible* to implement
this for Win9x using VFAT-32, so it's again not a "am I on Windows, and if
so which flavor?" issue at heart.