diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-08-26 17:51:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-27 02:51:44 +0200 |
commit | 211e4c6e9c1ab60bb2577dda6587fbec79f679b2 (patch) | |
tree | e1d306e71e4a107d6fe35583fa6dcbf60edc472c /Lib/pathlib.py | |
parent | 9de6be4e2ae605a1deb6fa72d5c5f66b07817e4c (diff) | |
download | cpython-git-211e4c6e9c1ab60bb2577dda6587fbec79f679b2.tar.gz |
bpo-33660: Fix PosixPath to resolve a relative path on root (#21974)
(cherry picked from commit 94ad6c674f7687ef22853cb8d42b440d6b42ddc8)
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r-- | Lib/pathlib.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py index 9f5e27b911..babc443dd3 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -329,7 +329,10 @@ class _PosixFlavour(_Flavour): # parent dir path, _, _ = path.rpartition(sep) continue - newpath = path + sep + name + if path.endswith(sep): + newpath = path + name + else: + newpath = path + sep + name if newpath in seen: # Already seen this path path = seen[newpath] |