summaryrefslogtreecommitdiffstats
path: root/Lib/pathlib.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-05-26 18:33:09 (GMT)
committerGitHub <noreply@github.com>2023-05-26 18:33:09 (GMT)
commiteca102ddac77a42c6fda62a283fe0802e0ff5549 (patch)
treebe4a6caed421dada9324c43afa0974d861f1895e /Lib/pathlib.py
parentdcee0aa9119243c294df820d6586d539ff039d3d (diff)
downloadcpython-eca102ddac77a42c6fda62a283fe0802e0ff5549.zip
cpython-eca102ddac77a42c6fda62a283fe0802e0ff5549.tar.gz
cpython-eca102ddac77a42c6fda62a283fe0802e0ff5549.tar.bz2
[3.12] GH-104947: Make pathlib.PureWindowsPath comparisons consistent across platforms (GH-104948) (GH-104990)
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>
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r--Lib/pathlib.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index 3d68c16..bfe26e1 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -421,7 +421,10 @@ class PurePath(object):
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