-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Description
In #31691 I switched pathlib.PureWindowsPath comparisons to use os.path.normcase() rather than str.lower(). This is probably a mistake, as @eryksun points out:
The inconsistency is with
ntpath.normcase()on Windows. It's probably for the best if the pure comparison methods revert to usingstr.lower()for the sake of consistency, not only withglob()andmatch(), but also with usingPureWindowsPathon POSIX. Maybe platform-dependent comparisons could be implemented onPath.On Windows,
ntpath.normcase()is based onLCMapStringEx(). It turns out that this function implements a case mapping for some non-BMP characters. WinAPICompareStringOrdinal(), on the other hand, has no case mapping for non-BMP characters, which is consistent with Microsoft's filesystems. Thus I'd prefer for a platform-dependent comparison to useCompareStringOrdinal()instead ofLCMapStringEx().