On 16 August 2016 at 14:09, eryk sun <eryk...@gmail.com> wrote:
> On Tue, Aug 16, 2016 at 10:53 AM, Paul Moore <p.f.mo...@gmail.com> wrote:
>>
>> Having said all this, I can't find the documentation stating that
>> bytes paths are deprecated - the open() documentation for 3.5 says
>> "file is either a string or bytes object giving the pathname (absolute
>> or relative to the current working directory) of the file to be opened
>> or an integer file descriptor of the file to be wrapped" and there's
>> no mention of a deprecation.
>
> Bytes paths aren't deprecated on Unix -- only on Windows, and only for
> the os functions. You can see the deprecation warning with -Wall:
>
>     >>> os.listdir(b'.')
>     __main__:1: DeprecationWarning: The Windows bytes API has been
> deprecated, use Unicode filenames instead

Thanks. So this remains a Windows-only issue (which is good).

> AFAIK this isn't documented.

It probably should be. Although if we're changing the deprecation to a
behaviour change, then maybe there's no point. But some of the
arguments here about breaking code are hinging on the idea that people
currently using the bytes API are using an (on the way to being)
unsupported feature and it's not really acceptable to take that
position if the deprecation wasn't announced. If the objections being
raised here (in the context of Japanese encodings and similar) would
apply equally to the bytes API being removed, then it seems to me that
we have a failure in our deprecation process, as those objections
should have been addressed when we started the deprecation.

Alternatively, if the deprecation of the os functions is OK, but it's
the deprecation of open (and presumably io.open) that's the issue,
then the whole process is somewhat problematic - it seems daft in the
long term to deprecate bytes paths in os functions like os.open and
yet allow them in the supposedly higher level io.open and the open
builtin. (And in the short term, it's illogical to me that the
deprecation isn't for open as well as the os functions).

I don't have a view on whether the cost to Japanese users is
sufficiently high that we should continue along the deprecation path
(or even divert to an enforced-UTF8 approach that's just as
problematic for them). But maybe it's worth a separate thread,
specifically focused on the use of bytes paths, rather than being
lumped in with other Windows encoding issues?

Paul
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to