New submission from Nikolay Aleksandrovich Pavlov <zyx....@gmail.com>:

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).

----------
components: Windows
messages: 310936
nosy: Nikolay Aleksandrovich Pavlov, paul.moore, steve.dower, tim.golden, 
zach.ware
priority: normal
severity: normal
status: open
title: os.path.ismount does not accept bytes objects
type: behavior
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32693>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to