Skip to content

Handle leading // for posixpath.commonpath #117201

Closed as not planned
Closed as not planned
@nineteendo

Description

@nineteendo

Bug report

Bug description:

>>> import posixpath
>>> posixpath.commonpath(["//foo/bar", "//foo/baz"])
'/foo'

Expected: //foo with precisely two leading slashes, see: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13

This can be quite easily solved using posixpath.splitroot, see the PR.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions