summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpxinwr <peixing.xin@windriver.com>2020-12-17 19:22:29 (GMT)
committerGitHub <noreply@github.com>2020-12-17 19:22:29 (GMT)
commit75dabfe7a8324a16687959cc401deb72b104a575 (patch)
tree9423e81bae68dad85ee0387c42dfb474a71e2191
parent96a09df64483b70c4215c7025a19b9d2f1636c55 (diff)
downloadcpython-75dabfe7a8324a16687959cc401deb72b104a575.zip
cpython-75dabfe7a8324a16687959cc401deb72b104a575.tar.gz
cpython-75dabfe7a8324a16687959cc401deb72b104a575.tar.bz2
bpo-31904: posixpath.expanduser() handles None user home on VxWorks (GH-23530)
-rw-r--r--Lib/posixpath.py3
-rw-r--r--Misc/NEWS.d/next/Library/2020-11-27-18-09-59.bpo-31904.g8k43d.rst2
2 files changed, 5 insertions, 0 deletions
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index ecb4e5a..62afbd0 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -262,6 +262,9 @@ def expanduser(path):
# password database, return the path unchanged
return path
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):
userhome = os.fsencode(userhome)
root = b'/'
diff --git a/Misc/NEWS.d/next/Library/2020-11-27-18-09-59.bpo-31904.g8k43d.rst b/Misc/NEWS.d/next/Library/2020-11-27-18-09-59.bpo-31904.g8k43d.rst
new file mode 100644
index 0000000..5a687d1
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-11-27-18-09-59.bpo-31904.g8k43d.rst
@@ -0,0 +1,2 @@
+:func:`posixpath.expanduser` returns the input *path* unchanged if
+user home directory is None on VxWorks.