Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
GH-104947: Make pathlib.PureWindowsPath comparisons consistent across…
… OSs

Use `str.lower()` rather than `ntpath.normcase()` to normalize case of
Windows paths. This restores behaviour from Python 3.11.
  • Loading branch information
barneygale committed May 25, 2023
commit 256e1ee4712c22ad9c52d0cba3eb7f3d93952974
5 changes: 4 additions & 1 deletion Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,10 @@ def _str_normcase(self):
try:
return self._str_normcase_cached
except AttributeError:
self._str_normcase_cached = self._flavour.normcase(str(self))
if _is_case_sensitive(self._flavour):
self._str_normcase_cached = str(self)
else:
self._str_normcase_cached = str(self).lower()
return self._str_normcase_cached

@property
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Make comparisons between :class:`pathlib.PureWindowsPath` objects consistent
across Windows and Posix.