Skip to content

Commit

Permalink
pythongh-118119: Re-use sep in posixpath.expanduser() (pythonGH-1…
Browse files Browse the repository at this point in the history
  • Loading branch information
nineteendo authored May 7, 2024
1 parent 1e42842 commit 6f768b7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Lib/posixpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 6f768b7

Please sign in to comment.