Skip to content

pathlib.WindowsPath resolve() behavior discrepancy between windows paths and unix paths  #124312

@kdheepak

Description

@kdheepak

Bug report

Bug description:

While working with pathlib.WindowsPath in Python, I am unable to compare two paths that Windows treats as the same:

import pathlib

path1 = pathlib.WindowsPath('/c/Temp/ServicesFix-3.4.Log')
path2 = pathlib.WindowsPath('C:/Temp/ServicesFix-3.4.Log')

print(path1 == path2)  # False
print(path1.resolve() == path2.resolve())  # False

print(path1.resolve())  # WindowsPath('C:/c/Temp/ServicesFix-3.4.Log')
print(path2.resolve())  # WindowsPath('C:/Temp/ServicesFix-3.4.Log')

This is also the cause of an unexpected warning when using ipython with uv on Windows: astral-sh/uv#7466

CPython versions tested on:

3.12

Operating systems tested on:

Windows

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