On Tue, Aug 16, 2016 at 10:53 AM, Paul Moore <[email protected]> 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
AFAIK this isn't documented.
Since the Windows CRT's _open implementation uses MultiByteToWideChar
without the flag MB_ERR_INVALID_CHARS, bytes paths should also be
deprecated for io.open. The problem is that bad DBCS sequences are
mapped silently to the default Unicode character instead of raising an
error.
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/