Closes #14768: os.path.expanduser('~/a') doesn't works correctly when HOME is '/'
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index c9829e1..9570a36 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -266,8 +266,8 @@
         root = b'/'
     else:
         root = '/'
-    userhome = userhome.rstrip(root) or userhome
-    return userhome + path[i:]
+    userhome = userhome.rstrip(root)
+    return (userhome + path[i:]) or root
 
 
 # Expand paths containing shell variable substitutions.