Issue32693
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2018-01-28 11:16 by Nikolay Aleksandrovich Pavlov, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Messages (1) | |||
|---|---|---|---|
| msg310936 - (view) | Author: Nikolay Aleksandrovich Pavlov (Nikolay Aleksandrovich Pavlov) | Date: 2018-01-28 11:16 | |
According to the documentation it ought to accept any path-like object, but actually throws for bytes ones. The trace of logic is the following: 1. ismount() from Lib/ntpath.py is using `os.fpath` which may return either bytes or str: https://github.com/python/cpython/blob/255f7a26da47ca6b7bd1d375b8a04920f68c119c/Lib/ntpath.py#L263. 2. The output is passed to _getvolumepathname unchanged. 3. The clinic defines that function’s only argument as [unicode](https://github.com/python/cpython/blob/255f7a26da47ca6b7bd1d375b8a04920f68c119c/Modules/posixmodule.c#L3793). 4. If clinic was not there it would still require to change how path_wchar is defined below, PyUnicode… functions will not accept bytes object: https://github.com/python/cpython/blob/255f7a26da47ca6b7bd1d375b8a04920f68c119c/Modules/posixmodule.c#L3808. Suggestion: change `Lib/ntpath.py` to use `os.fsdecode` in place of `os.fspath`. This is a relay of issue https://github.com/powerline/powerline/issues/1876. Initial reporter observed bug on Python 3.6 (patch unknown), I could see an issue in current master (all links above point to that). |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:57 | admin | set | github: 76874 |
| 2018-01-28 21:12:56 | eryksun | set | status: open -> closed superseder: support bytes paths in nt _getdiskusage, _getvolumepathname, and _getfinalpathname resolution: duplicate stage: resolved |
| 2018-01-28 11:16:16 | Nikolay Aleksandrovich Pavlov | create | |