Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-10 Thread Serhiy Storchaka
On 08.02.16 16:32, Victor Stinner wrote: On Python 2, it wasn't possible to use Unicode for filenames, many functions fail badly with Unicode, especially when you mix bytes and Unicode. Even not all os functions support Unicode. See http://bugs.python.org/issue18695.

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-09 Thread Paul Moore
On 9 February 2016 at 01:57, Chris Barker - NOAA Federal wrote:OTOH, it's a > All I can say is "ouch". Hard to call it a regression to no longer > allow this mess.. OTOH, it's a major regression for someone using an 8-bit codepage that doesn't have these problems. Code

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-09 Thread Victor Stinner
2016-02-09 1:37 GMT+01:00 eryk sun : > For example, in codepage 932 (Japanese), it's an error if a lead byte > (i.e. 0x81-0x9F, 0xE0-0xFC) is followed by a trailing byte with a > value less than 0x40 (note that ASCII 0-9 is 0x30-0x39, so this is not > uncommon). In this case the

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-09 Thread Victor Stinner
Hi, 2016-02-08 18:02 GMT+01:00 Brett Cannon : > If Unicode string don't work in Python 2 then what is Python 2/3 to do as a > cross-platform solution if we completely remove bytes support in Python 3? > Wouldn't that mean there is no common type between Python 2 & 3 that one can

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-09 Thread Stephen J. Turnbull
Chris Barker - NOAA Federal writes: > All I can say is "ouch". Hard to call it a regression to no longer > allow this mess... We can't "disallow" the mess, it's embedded in the lunatic computing environment (which I happen to live in). We can't even stop people from using existing Python

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-09 Thread Victor Stinner
2016-02-09 1:37 GMT+01:00 eryk sun : > For example, in codepage 932 (Japanese), it's an error if a lead byte > (i.e. 0x81-0x9F, 0xE0-0xFC) is followed by a trailing byte with a > value less than 0x40 (note that ASCII 0-9 is 0x30-0x39, so this is not > uncommon). In this case the

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-09 Thread eryk sun
On Tue, Feb 9, 2016 at 3:22 AM, Victor Stinner wrote: > 2016-02-09 1:37 GMT+01:00 eryk sun : >> For example, in codepage 932 (Japanese), it's an error if a lead byte >> (i.e. 0x81-0x9F, 0xE0-0xFC) is followed by a trailing byte with a >> value less

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-09 Thread Victor Stinner
2016-02-08 19:26 GMT+01:00 Paul Moore : > On 8 February 2016 at 14:32, Victor Stinner wrote: >> Since 3.3, functions of the os module started to emit >> DeprecationWarning when called with bytes filenames. > > Everywhere? Or just on Windows? I can't

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-09 Thread Paul Moore
On 9 February 2016 at 10:13, Victor Stinner wrote: > IMHO we have to put a line somewhere between Python 2 and Python 3. > For some specific use cases, there is no good solution which works on > both Python versions. > > For filenames, there is no simple design on Python

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-09 Thread eryk sun
On Tue, Feb 9, 2016 at 3:21 AM, Victor Stinner wrote: > 2016-02-09 1:37 GMT+01:00 eryk sun : >> For example, in codepage 932 (Japanese), it's an error if a lead byte >> (i.e. 0x81-0x9F, 0xE0-0xFC) is followed by a trailing byte with a >> value less

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-09 Thread Victor Stinner
Le mercredi 10 février 2016, Steve Dower a écrit : > > I really don't like the idea of not being able to use bytes in cross > platform code. Unless it's become feasible to use Unicode for lossless > filenames on Linux - last I heard it wasn't. > The point of my email is

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Matthias Bussonnier
> On Feb 8, 2016, at 06:40, Victor Stinner wrote: > > 2016-02-08 15:32 GMT+01:00 Victor Stinner : >> Since 3.3, functions of the os module started to emit >> DeprecationWarning when called with bytes filenames. >> (...) >> Recently, an user

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Brett Cannon
On Mon, 8 Feb 2016 at 06:33 Victor Stinner wrote: > Hi, > > Since 3.3, functions of the os module started to emit > DeprecationWarning when called with bytes filenames. > > The rationale is quite simple: Windows native type for filenames is > Unicode, and the Windows

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Chris Barker - NOAA Federal
All I can say is "ouch". Hard to call it a regression to no longer allow this mess... CHB > On Feb 8, 2016, at 4:37 PM, eryk sun wrote: > >> On Mon, Feb 8, 2016 at 2:41 PM, Chris Barker wrote: >> Just to clarify -- what does it currently do for bytes?

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

2016-02-08 Thread Victor Stinner
Hi, Since 3.3, functions of the os module started to emit DeprecationWarning when called with bytes filenames. The rationale is quite simple: Windows native type for filenames is Unicode, and the Windows has a weird behaviour when you use bytes. For example, os.listdir(b'.') gives you paths

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Victor Stinner
2016-02-08 15:32 GMT+01:00 Victor Stinner : > Since 3.3, functions of the os module started to emit > DeprecationWarning when called with bytes filenames. > (...) > Recently, an user complained that os.walk() doesn't work with bytes on > Windows anymore: > (...) It's

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Paul Moore
On 8 February 2016 at 14:32, Victor Stinner wrote: > Since 3.3, functions of the os module started to emit > DeprecationWarning when called with bytes filenames. Everywhere? Or just on Windows? I can't tell from your email and I don't have a Unix system to hand to

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Alexander Walters
On 2/8/2016 12:02, Brett Cannon wrote: If Unicode string don't work in Python 2 then what is Python 2/3 to do as a cross-platform solution if we completely remove bytes support in Python 3? Wouldn't that mean there is no common type between Python 2 & 3 that one can use which will work

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Andrew Barnert via Python-Dev
On Monday, February 8, 2016 9:11 AM, Alexander Walters wrote: > > On 2/8/2016 12:02, Brett Cannon wrote: >> >> >> If Unicode string don't work in Python 2 then what is Python 2/3 to do >> as a cross-platform solution if we completely remove bytes support in >>

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread Chris Barker
On Mon, Feb 8, 2016 at 6:32 AM, Victor Stinner wrote: > Windows native type for filenames is > Unicode, and the Windows has a weird behaviour when you use bytes. Just to clarify -- what does it currently do for bytes? IIUC, Windows uses UTF-16, so can you pass in

Re: [Python-Dev] Windows: Remove support of bytes filenames in the os module?

2016-02-08 Thread eryk sun
On Mon, Feb 8, 2016 at 2:41 PM, Chris Barker wrote: > Just to clarify -- what does it currently do for bytes? IIUC, Windows uses > UTF-16, so can you pass in UTF-16 bytes? Or when using bytes is is assuming > some Windows ANSI-compatible encoding? (and what does it return?)