mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Closes #14768: os.path.expanduser('~/a') doesn't works correctly when HOME is '/'
This commit is contained in:
parent
d576c711a5
commit
7f0d88860f
4 changed files with 6 additions and 2 deletions
|
@ -298,6 +298,7 @@ class PosixPathTest(unittest.TestCase):
|
|||
with support.EnvironmentVarGuard() as env:
|
||||
env['HOME'] = '/'
|
||||
self.assertEqual(posixpath.expanduser("~"), "/")
|
||||
self.assertEqual(posixpath.expanduser("~/foo"), "/foo")
|
||||
# expanduser should fall back to using the password database
|
||||
del env['HOME']
|
||||
home = pwd.getpwuid(os.getuid()).pw_dir
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue