STINNER Victor added the comment:

I don't understand the rationale to add new functions using bytes filenames.

IMHO it's a bad practice to pass bytes filenames to write portable code. On 
Windows, bytes lead to strange bugs: os.listdir(bytes) gives you filenames 
which don't exist when a filename cannot be encoded to the ANSI code page.

On UNIX, os.fsencode() and os.fsdecode() allows you to convert filenames 
between unicode and bytes. It provides nice properties like 
os.fsencode(os.fsdecode(value))==value where value is bytes. No need to add new 
APIs, use existing APIs an use os.fsencode() and os.fsdecode() on top of them.

Bytes filenames are deprecated on Windows since Python 3.2. The new 
os.scandir() function doesn't support bytes for example, it's a deliberate 
choice.

Maybe I missed an important technical issue?

----------
nosy: +haypo

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24230>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to