changeset: 76854:ce39a4ec2906 parent: 76851:0d9067cde462 parent: 76852:e472481b6d73 user: Jesus Cea date: Thu May 10 05:16:41 2012 +0200 files: Lib/test/test_posixpath.py Misc/ACKS Misc/NEWS description: MERGE: Closes #14768: os.path.expanduser('~/a') doesn't works correctly when HOME is '/' diff -r 0d9067cde462 -r ce39a4ec2906 Lib/posixpath.py --- a/Lib/posixpath.py Wed May 09 22:25:00 2012 +0200 +++ b/Lib/posixpath.py Thu May 10 05:16:41 2012 +0200 @@ -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. diff -r 0d9067cde462 -r ce39a4ec2906 Lib/test/test_posixpath.py --- a/Lib/test/test_posixpath.py Wed May 09 22:25:00 2012 +0200 +++ b/Lib/test/test_posixpath.py Thu May 10 05:16:41 2012 +0200 @@ -300,6 +300,7 @@ 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 diff -r 0d9067cde462 -r ce39a4ec2906 Misc/ACKS --- a/Misc/ACKS Wed May 09 22:25:00 2012 +0200 +++ b/Misc/ACKS Thu May 10 05:16:41 2012 +0200 @@ -335,6 +335,7 @@ Martin Franklin Bruce Frederiksen Robin Friedrich +Bradley Froehle Ivan Frohne Matthias Fuchs Jim Fulton diff -r 0d9067cde462 -r ce39a4ec2906 Misc/NEWS --- a/Misc/NEWS Wed May 09 22:25:00 2012 +0200 +++ b/Misc/NEWS Thu May 10 05:16:41 2012 +0200 @@ -139,6 +139,8 @@ - Issue #13815: TarFile.extractfile() now returns io.BufferedReader objects. +- Issue #14768: os.path.expanduser('~/a') doesn't works correctly when HOME is '/'. + - Issue #14371: Support bzip2 in zipfile module. Patch by Serhiy Storchaka. - Issue #13183: Fix pdb skipping frames after hitting a breakpoint and running

AltStyle によって変換されたページ (->オリジナル) /