summaryrefslogtreecommitdiffstats
path: root/Lib/pathlib.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2015-02-15 17:06:54 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2015-02-15 17:06:54 (GMT)
commit2d07b855855c13814c2050f2f062aadf936fa886 (patch)
tree91f77b70250a13fe4b5ae714a225588795bcbb59 /Lib/pathlib.py
parent90caf017eecdc3e734df144ec793af4dda21953e (diff)
parent57fffd6f99d55ccd623b381622b989410a695b99 (diff)
downloadcpython-2d07b855855c13814c2050f2f062aadf936fa886.zip
cpython-2d07b855855c13814c2050f2f062aadf936fa886.tar.gz
cpython-2d07b855855c13814c2050f2f062aadf936fa886.tar.bz2
Issue #23146: Fix mishandling of absolute Windows paths with forward slashes in pathlib.
Detected and fixed by Serhiy.
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r--Lib/pathlib.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index e1b07ca..01e66a0 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -73,6 +73,10 @@ class _Flavour(object):
# parts. This makes the result of parsing e.g.
# ("C:", "/", "a") reasonably intuitive.
for part in it:
+ if not part:
+ continue
+ if altsep:
+ part = part.replace(altsep, sep)
drv = self.splitroot(part)[0]
if drv:
break