summaryrefslogtreecommitdiffstats
path: root/Lib/posixpath.py
diff options
context:
space:
mode:
authorJesus Cea <jcea@jcea.es>2012-05-10 03:10:50 (GMT)
committerJesus Cea <jcea@jcea.es>2012-05-10 03:10:50 (GMT)
commit7f0d88860f04d6411dbc1218bf78d9ec5ce153b8 (patch)
tree8c08d2d132666b6f9924d6e7d1f0acbd6e3c0d4a /Lib/posixpath.py
parentd576c711a510204604f707e1cbf773b4a39f21a3 (diff)
downloadcpython-7f0d88860f04d6411dbc1218bf78d9ec5ce153b8.zip
cpython-7f0d88860f04d6411dbc1218bf78d9ec5ce153b8.tar.gz
cpython-7f0d88860f04d6411dbc1218bf78d9ec5ce153b8.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 c9829e1..9570a36 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -266,8 +266,8 @@ def expanduser(path):
root = b'/'
else:
root = '/'
- userhome = userhome.rstrip(root) or userhome
- return userhome + path[i:]
+ userhome = userhome.rstrip(root)
+ return (userhome + path[i:]) or root
# Expand paths containing shell variable substitutions.