
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2017-07-08 16:27 byarigo, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 2634 | merged | serhiy.storchaka,2017-07-08 17:28 | |
| PR 2656 | merged | serhiy.storchaka,2017-07-11 03:45 | |
| PR 2657 | merged | serhiy.storchaka,2017-07-11 03:52 | |
| Messages (7) | |||
|---|---|---|---|
| msg297960 -(view) | Author: Armin Rigo (arigo)*![]() | Date: 2017-07-08 16:27 | |
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', ...] | |||
| msg297962 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2017-07-08 17:33 | |
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. | |||
| msg297963 -(view) | Author: Armin Rigo (arigo)*![]() | Date: 2017-07-08 18:21 | |
I've also been pointed tohttps://bugs.python.org/issue26800 . | |||
| msg297984 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2017-07-09 03:59 | |
Oh, I forgot that this feature already is deprecated! | |||
| msg298111 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2017-07-11 03:36 | |
New changeset1180e5a51871fa53ca6892e83fd2e69dc2600447 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 | |||
| msg298116 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2017-07-11 04:16 | |
New changesetecfe4f678bfb0e3c19c90fd7db79c5f3c76023e4 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 | |||
| msg298118 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2017-07-11 04:43 | |
New changeset7527c32f5fedc3260d767900f1014495c0a1b7a5 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 | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:48 | admin | set | github: 75062 |
| 2017-07-11 04:44:12 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2017-07-11 04:43:16 | serhiy.storchaka | set | messages: +msg298118 |
| 2017-07-11 04:16:13 | serhiy.storchaka | set | messages: +msg298116 |
| 2017-07-11 03:52:49 | serhiy.storchaka | set | pull_requests: +pull_request2722 |
| 2017-07-11 03:45:18 | serhiy.storchaka | set | pull_requests: +pull_request2721 |
| 2017-07-11 03:36:48 | serhiy.storchaka | set | messages: +msg298111 |
| 2017-07-09 03:59:36 | serhiy.storchaka | set | messages: +msg297984 |
| 2017-07-08 18:21:16 | arigo | set | messages: +msg297963 |
| 2017-07-08 17:33:56 | serhiy.storchaka | set | versions: + Python 3.6 nosy: +serhiy.storchaka messages: +msg297962 stage: patch review |
| 2017-07-08 17:28:27 | serhiy.storchaka | set | pull_requests: +pull_request2699 |
| 2017-07-08 16:28:28 | alex | set | nosy: +alex |
| 2017-07-08 16:27:45 | arigo | create | |