Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os.path.ismount does not accept bytes objects #76874

Closed
NikolayAleksandrovichPavlov mannequin opened this issue Jan 28, 2018 · 1 comment
Closed

os.path.ismount does not accept bytes objects #76874

NikolayAleksandrovichPavlov mannequin opened this issue Jan 28, 2018 · 1 comment
Labels
3.7 (EOL) end of life OS-windows type-bug An unexpected behavior, bug, or error

Comments

@NikolayAleksandrovichPavlov
Copy link
Mannequin

BPO 32693
Nosy @pfmoore, @tjguk, @zware, @zooba
Superseder
  • bpo-32556: support bytes paths in nt _getdiskusage, _getvolumepathname, and _getfinalpathname
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2018-01-28.21:12:56.488>
    created_at = <Date 2018-01-28.11:16:16.002>
    labels = ['type-bug', '3.7', 'OS-windows']
    title = 'os.path.ismount does not accept bytes objects'
    updated_at = <Date 2018-01-28.21:12:56.487>
    user = 'https://bugs.python.org/NikolayAleksandrovichPavlov'

    bugs.python.org fields:

    activity = <Date 2018-01-28.21:12:56.487>
    actor = 'eryksun'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-01-28.21:12:56.488>
    closer = 'eryksun'
    components = ['Windows']
    creation = <Date 2018-01-28.11:16:16.002>
    creator = 'Nikolay Aleksandrovich Pavlov'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32693
    keywords = []
    message_count = 1.0
    messages = ['310936']
    nosy_count = 5.0
    nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'steve.dower', 'Nikolay Aleksandrovich Pavlov']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '32556'
    type = 'behavior'
    url = 'https://bugs.python.org/issue32693'
    versions = ['Python 3.6', 'Python 3.7']

    @NikolayAleksandrovichPavlov
    Copy link
    Mannequin Author

    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:
      path = os.fspath(path)
      .
    2. The output is passed to _getvolumepathname unchanged.
    3. The clinic defines that function’s only argument as unicode.
    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:
      path_wchar = PyUnicode_AsUnicodeAndSize(path, &buflen);
      .

    Suggestion: change [Lib/ntpath.py](https://github.com/python/cpython/blob/main/Lib/ntpath.py) to use os.fsdecode in place of os.fspath.

    This is a relay of issue powerline/powerline#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).

    @NikolayAleksandrovichPavlov NikolayAleksandrovichPavlov mannequin added 3.7 (EOL) end of life OS-windows type-bug An unexpected behavior, bug, or error labels Jan 28, 2018
    @eryksun eryksun closed this as completed Jan 28, 2018
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life OS-windows type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant