mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Closes #14768: os.path.expanduser('~/a') doesn't works correctly when HOME is '/'
This commit is contained in:
parent
d576c711a5
commit
7f0d88860f
4 changed files with 6 additions and 2 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue