Use `str.lower()` rather than `ntpath.normcase()` to normalize case of
Windows paths. This restores behaviour from Python 3.11.
(cherry picked from commit
ad0be361c9922a918c7c3eaf83e1d8f2b019279c)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
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
self.assertEqual(P('a/B'), P('A/b'))
self.assertEqual(P('C:a/B'), P('c:A/b'))
self.assertEqual(P('//Some/SHARE/a/B'), P('//somE/share/A/b'))
+ self.assertEqual(P('\u0130'), P('i\u0307'))
def test_as_uri(self):
P = self.cls
--- /dev/null
+Make comparisons between :class:`pathlib.PureWindowsPath` objects consistent
+across Windows and Posix to match 3.11 behavior.