Skip to content

ntpath.realpath() doesn't always normalize the case #114820

@moi15moi

Description

@moi15moi

Bug report

Bug description:

In some case, ntpath.realpath doesn't normalize the case like the one in the windows file explorer.

Example

from ntpath import realpath
print(realpath("c:\\windows\\notepad.exe"))

Expected result: C:\WINDOWS\notepad.exe
Result: C:\Windows\notepad.exe

I took the expected result from the file explorer:
image

Note

Under the hood, cpython use GetFinalPathNameByHandle and from what I can see, it has the same problem

CPython versions tested on:

3.10

Operating systems tested on:

Windows 10 version 22h2 build 19045.3930

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowspendingThe issue will be closed if no feedback is providedtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions