[issue30879] os.listdir(bytes) gives a list of bytes, but os.listdir(buffer) gives a list of unicodes

2017-07-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30879] os.listdir(bytes) gives a list of bytes, but os.listdir(buffer) gives a list of unicodes

2017-07-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 7527c32f5fedc3260d767900f1014495c0a1b7a5 by Serhiy Storchaka in 
branch '3.5':
[3.5] bpo-30879: os.listdir() and os.scandir() now emit bytes names when 
(GH-2634) (#2657)
https://github.com/python/cpython/commit/7527c32f5fedc3260d767900f1014495c0a1b7a5


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30879] os.listdir(bytes) gives a list of bytes, but os.listdir(buffer) gives a list of unicodes

2017-07-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset ecfe4f678bfb0e3c19c90fd7db79c5f3c76023e4 by Serhiy Storchaka in 
branch '3.6':
[3.6] bpo-30879: os.listdir() and os.scandir() now emit bytes names when 
(GH-2634) (#2656)
https://github.com/python/cpython/commit/ecfe4f678bfb0e3c19c90fd7db79c5f3c76023e4


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30879] os.listdir(bytes) gives a list of bytes, but os.listdir(buffer) gives a list of unicodes

2017-07-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +2722

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30879] os.listdir(bytes) gives a list of bytes, but os.listdir(buffer) gives a list of unicodes

2017-07-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +2721

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30879] os.listdir(bytes) gives a list of bytes, but os.listdir(buffer) gives a list of unicodes

2017-07-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 1180e5a51871fa53ca6892e83fd2e69dc2600447 by Serhiy Storchaka in 
branch 'master':
bpo-30879: os.listdir() and os.scandir() now emit bytes names when (#2634)
https://github.com/python/cpython/commit/1180e5a51871fa53ca6892e83fd2e69dc2600447


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30879] os.listdir(bytes) gives a list of bytes, but os.listdir(buffer) gives a list of unicodes

2017-07-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Oh, I forgot that this feature already is deprecated!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30879] os.listdir(bytes) gives a list of bytes, but os.listdir(buffer) gives a list of unicodes

2017-07-08 Thread Armin Rigo

Armin Rigo added the comment:

I've also been pointed to https://bugs.python.org/issue26800 .

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30879] os.listdir(bytes) gives a list of bytes, but os.listdir(buffer) gives a list of unicodes

2017-07-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Good catch Armin! PR 2634 fixes this inconsistency.

Maybe it is worth to deprecate support of other bytes-like object except bytes. 
open(), os.fspath() and os.path functions don't support them.

--
nosy: +serhiy.storchaka
stage:  -> patch review
versions: +Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30879] os.listdir(bytes) gives a list of bytes, but os.listdir(buffer) gives a list of unicodes

2017-07-08 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +2699

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30879] os.listdir(bytes) gives a list of bytes, but os.listdir(buffer) gives a list of unicodes

2017-07-08 Thread Alex Gaynor

Changes by Alex Gaynor :


--
nosy: +alex

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30879] os.listdir(bytes) gives a list of bytes, but os.listdir(buffer) gives a list of unicodes

2017-07-08 Thread Armin Rigo

New submission from Armin Rigo:

The ``os`` functions generally accept any buffer-supporting object as file 
names, and interpret it as if ``bytes()`` had been called on it.  However, 
``os.listdir(x)`` uses the type of ``x`` to know if it should return a list of 
bytes or a list of unicodes---and the condition seems to be ``isinstance(x, 
bytes)``.  So we get this kind of inconsistent behaviour:

>>> os.listdir(b".")
[b'python', b'Include', b'python-config.py', ...]

>>> os.listdir(bytearray(b"."))
['python', 'Include', 'python-config.py', ...]

--
components: Library (Lib)
messages: 297960
nosy: arigo
priority: normal
severity: normal
status: open
title: os.listdir(bytes) gives a list of bytes, but os.listdir(buffer) gives a 
list of unicodes
type: behavior
versions: Python 3.5, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com