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.

Author Nikolay Aleksandrovich Pavlov
Recipients Nikolay Aleksandrovich Pavlov, paul.moore, steve.dower, tim.golden, zach.ware
Date 2018-01-28.11:16:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1517138176.06.0.467229070634.issue32693@psf.upfronthosting.co.za>
In-reply-to
Content
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
2018-01-28 11:16:16Nikolay Aleksandrovich Pavlovsetrecipients: + Nikolay Aleksandrovich Pavlov, paul.moore, tim.golden, zach.ware, steve.dower
2018-01-28 11:16:16Nikolay Aleksandrovich Pavlovsetmessageid: <1517138176.06.0.467229070634.issue32693@psf.upfronthosting.co.za>
2018-01-28 11:16:15Nikolay Aleksandrovich Pavlovlinkissue32693 messages
2018-01-28 11:16:15Nikolay Aleksandrovich Pavlovcreate