[Python-Dev] Windows: Remove support of bytes filenames in theos module?

Paul Moore p.f.moore at gmail.com
Wed Feb 10 03:30:24 EST 2016


On 10 February 2016 at 08:00, Stephen J. Turnbull <stephen at xemacs.org> wrote:
>> The earlier issue was that that doesn't work (e.g. a bytes path
>  > from os.scandir couldn't be passed back into open()).
>
> My purely-from-the-user-side take is that that's just a bug in
> os.scandir that should be fixed, and that even though the complexity
> that occasions such bugs is an undesirable aspect of Python (v2)
> programming, it's not a bug because it *can't* be fixed -- you have to
> fix the world, not Python.  Or switch to Python 3.
>
> I don't know enough to have an opinion on whether "fixing" os.scandir
> could cause other problems.

The original os.scandir issue was encountered on Python 3. And I do
agree with Victor that the correct answer was to point out to the user
that they should be using unicode/surrogateescape. What I disagree
with is mandating that (by removing the bytes interface) on anything
other than all platforms at once, because that doesn't remove the
problem (of coders using the wrong approach on Python 3) it just makes
the code such users write non-portable.

Whether removing the bytes interface is feasible, given that there's
then no way that works across Python 2 and 3 of writing code that
manipulates the sort of bytes-that-use-multiple-encodings data that
you mention, is a separate issue.

Paul


More information about the Python-Dev mailing list