Skip to content

pathlib.PureWindowsPath.is_absolute() can return False for UNC paths #105476

Closed
@barneygale

Description

@barneygale

return bool(self.drive and self.root)

Per @eryksun:

Note that this check is wrong for incomplete UNC paths such as "//", "//spam", "//?/UNC/", and "//?/UNC/spam". Such paths lack a root and don't even have an implicit root. However, they're still absolute because they don't depend on the current working directory. I don't know how or whether you want to handle this edge case.

ntpath.isabs() gets this case right, but it's still wrong for rooted paths such as "/spam".

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtopic-pathlibtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions