mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-118119: Re-use sep
in posixpath.expanduser()
(GH-118120)
This commit is contained in:
parent
1e428426c8
commit
6f768b71ba
1 changed files with 2 additions and 5 deletions
|
@ -298,11 +298,8 @@ def expanduser(path):
|
|||
return path
|
||||
if isinstance(path, bytes):
|
||||
userhome = os.fsencode(userhome)
|
||||
root = b'/'
|
||||
else:
|
||||
root = '/'
|
||||
userhome = userhome.rstrip(root)
|
||||
return (userhome + path[i:]) or root
|
||||
userhome = userhome.rstrip(sep)
|
||||
return (userhome + path[i:]) or sep
|
||||
|
||||
|
||||
# Expand paths containing shell variable substitutions.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue