bpo-31904: posixpath.expanduser() handles None user home on VxWorks (GH-23530)

This commit is contained in:
pxinwr 2020-12-18 03:22:29 +08:00 committed by GitHub
parent 96a09df644
commit 75dabfe7a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -262,6 +262,9 @@ def expanduser(path):
# password database, return the path unchanged # password database, return the path unchanged
return path return path
userhome = pwent.pw_dir userhome = pwent.pw_dir
# if no user home, return the path unchanged on VxWorks
if userhome is None and sys.platform == "vxworks":
return path
if isinstance(path, bytes): if isinstance(path, bytes):
userhome = os.fsencode(userhome) userhome = os.fsencode(userhome)
root = b'/' root = b'/'

View File

@ -0,0 +1,2 @@
:func:`posixpath.expanduser` returns the input *path* unchanged if
user home directory is None on VxWorks.