summaryrefslogtreecommitdiffstats
path: root/Lib/posixpath.py
diff options
context:
space:
mode:
authorJesus Cea <jcea@jcea.es>2012-05-10 03:01:11 (GMT)
committerJesus Cea <jcea@jcea.es>2012-05-10 03:01:11 (GMT)
commitf2011e3e49a91e613bbe69a198c2b2239cb874a6 (patch)
tree537e9e8b5aefda68638bb5eaf031209244d88c08 /Lib/posixpath.py
parent95f42a86dda8e26ef13a3ce67461e00705173929 (diff)
downloadcpython-f2011e3e49a91e613bbe69a198c2b2239cb874a6.zip
cpython-f2011e3e49a91e613bbe69a198c2b2239cb874a6.tar.gz
cpython-f2011e3e49a91e613bbe69a198c2b2239cb874a6.tar.bz2
Closes #14768: os.path.expanduser('~/a') doesn't works correctly when HOME is '/'
Diffstat (limited to 'Lib/posixpath.py')
-rw-r--r--Lib/posixpath.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index aae38d5..163c00c 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -267,8 +267,8 @@ def expanduser(path):
except KeyError:
return path
userhome = pwent.pw_dir
- userhome = userhome.rstrip('/') or userhome
- return userhome + path[i:]
+ userhome = userhome.rstrip('/')
+ return (userhome + path[i:]) or '/'
# Expand paths containing shell variable substitutions.