summaryrefslogtreecommitdiffstats
path: root/Lib/posixpath.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-02-18 10:21:04 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-02-18 10:21:04 (GMT)
commit467393dff5666b87eafe46660abf6ea0e2018c64 (patch)
treed00f18265dd9f45aad6b7d75e0cc5cad25944fcc /Lib/posixpath.py
parent9acb9bc65914a890a5ec2181e2237bd8dc826409 (diff)
downloadcpython-467393dff5666b87eafe46660abf6ea0e2018c64.zip
cpython-467393dff5666b87eafe46660abf6ea0e2018c64.tar.gz
cpython-467393dff5666b87eafe46660abf6ea0e2018c64.tar.bz2
Fix posixpath.realpath() for multiple pardirs (fixes issue #6975).
Diffstat (limited to 'Lib/posixpath.py')
-rw-r--r--Lib/posixpath.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index 7e9dd85..bc76c90 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -417,9 +417,11 @@ def _joinrealpath(path, rest, seen):
if name == pardir:
# parent dir
if path:
- path = dirname(path)
+ path, name = split(path)
+ if name == pardir:
+ path = join(path, pardir, pardir)
else:
- path = name
+ path = pardir
continue
newpath = join(path, name)
if not islink(newpath):