diff options
author | Jesus Cea <jcea@jcea.es> | 2012-05-10 05:01:11 +0200 |
---|---|---|
committer | Jesus Cea <jcea@jcea.es> | 2012-05-10 05:01:11 +0200 |
commit | f2011e3e49a91e613bbe69a198c2b2239cb874a6 (patch) | |
tree | 537e9e8b5aefda68638bb5eaf031209244d88c08 /Lib/posixpath.py | |
parent | 95f42a86dda8e26ef13a3ce67461e00705173929 (diff) | |
download | cpython-git-f2011e3e49a91e613bbe69a198c2b2239cb874a6.tar.gz |
Closes #14768: os.path.expanduser('~/a') doesn't works correctly when HOME is '/'
Diffstat (limited to 'Lib/posixpath.py')
-rw-r--r-- | Lib/posixpath.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/posixpath.py b/Lib/posixpath.py index aae38d5abf..163c00c445 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. |