]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-31904: posixpath.expanduser() handles None user home on VxWorks (GH-23530)
authorpxinwr <peixing.xin@windriver.com>
Thu, 17 Dec 2020 19:22:29 +0000 (03:22 +0800)
committerGitHub <noreply@github.com>
Thu, 17 Dec 2020 19:22:29 +0000 (20:22 +0100)
Lib/posixpath.py
Misc/NEWS.d/next/Library/2020-11-27-18-09-59.bpo-31904.g8k43d.rst [new file with mode: 0644]

index ecb4e5a8f7072c52effe4606b7406190a2dd7787..62afbd0ccf0f0f70f9393bc6a6ff88bc55a702e1 100644 (file)
@@ -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 (file)
index 0000000..5a687d1
--- /dev/null
@@ -0,0 +1,2 @@
+:func:`posixpath.expanduser` returns the input *path* unchanged if
+user home directory is None on VxWorks.