changeset: 76853:299dc54ad014 branch: 2.7 parent: 76849:d3ddbad31b3e user: Jesus Cea date: Thu May 10 05:01:11 2012 +0200 files: Lib/posixpath.py Lib/test/test_posixpath.py Misc/ACKS Misc/NEWS description: Closes #14768: os.path.expanduser('~/a') doesn't works correctly when HOME is '/' diff -r d3ddbad31b3e -r 299dc54ad014 Lib/posixpath.py --- a/Lib/posixpath.py Wed May 09 14:59:24 2012 +0300 +++ b/Lib/posixpath.py Thu May 10 05:01:11 2012 +0200 @@ -267,8 +267,8 @@ except KeyError: return path userhome = pwent.pw_dir - userhome = userhome.rstrip('/') or userhome - return userhome + path[i:] + userhome = userhome.rstrip('/') + return (userhome + path[i:]) or '/' # Expand paths containing shell variable substitutions. diff -r d3ddbad31b3e -r 299dc54ad014 Lib/test/test_posixpath.py --- a/Lib/test/test_posixpath.py Wed May 09 14:59:24 2012 +0300 +++ b/Lib/test/test_posixpath.py Thu May 10 05:01:11 2012 +0200 @@ -201,6 +201,7 @@ with test_support.EnvironmentVarGuard() as env: env['HOME'] = '/' self.assertEqual(posixpath.expanduser("~"), "/") + self.assertEqual(posixpath.expanduser("~/foo"), "/foo") def test_normpath(self): self.assertEqual(posixpath.normpath(""), ".") diff -r d3ddbad31b3e -r 299dc54ad014 Misc/ACKS --- a/Misc/ACKS Wed May 09 14:59:24 2012 +0300 +++ b/Misc/ACKS Thu May 10 05:01:11 2012 +0200 @@ -274,6 +274,7 @@ John Fouhy Martin Franklin Robin Friedrich +Bradley Froehle Ivan Frohne Jim Fulton Tadayoshi Funaba diff -r d3ddbad31b3e -r 299dc54ad014 Misc/NEWS --- a/Misc/NEWS Wed May 09 14:59:24 2012 +0300 +++ b/Misc/NEWS Thu May 10 05:01:11 2012 +0200 @@ -60,6 +60,8 @@ Library ------- +- Issue #14768: os.path.expanduser('~/a') doesn't works correctly when HOME is '/'. + - Issue #13183: Fix pdb skipping frames after hitting a breakpoint and running step. Patch by Xavier de Gaye.

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