commit | f2011e3e49a91e613bbe69a198c2b2239cb874a6 | [log] [tgz] |
---|---|---|
author | Jesus Cea <jcea@jcea.es> | Thu May 10 05:01:11 2012 +0200 |
committer | Jesus Cea <jcea@jcea.es> | Thu May 10 05:01:11 2012 +0200 |
tree | 537e9e8b5aefda68638bb5eaf031209244d88c08 | |
parent | 95f42a86dda8e26ef13a3ce67461e00705173929 [diff] [blame] |
Closes #14768: os.path.expanduser('~/a') doesn't works correctly when HOME is '/'
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 @@ 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.