cpython: 50ed06b3d419 (original) (raw)

Mercurial > cpython

changeset 82247:50ed06b3d419 2.7

Fix posixpath.realpath() for multiple pardirs (fixes issue #6975). [#6975]

Serhiy Storchaka storchaka@gmail.com
date Mon, 18 Feb 2013 12:20:44 +0200
parents a80ea934da9a
children bb5a8564e186
files Lib/posixpath.py Lib/test/test_posixpath.py
diffstat 2 files changed, 14 insertions(+), 2 deletions(-)[+] [-] Lib/posixpath.py 6 Lib/test/test_posixpath.py 10

line wrap: on

line diff

--- a/Lib/posixpath.py +++ b/Lib/posixpath.py @@ -382,9 +382,11 @@ def _joinrealpath(path, rest, seen): if name == pardir: # parent dir if path:

--- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -214,6 +214,16 @@ class PosixPathTest(unittest.TestCase): self.assertEqual(posixpath.normpath("///foo/.//bar//.//..//.//baz"), "/foo/baz") self.assertEqual(posixpath.normpath("///..//./foo/.//bar"), "/foo/bar")

+

+ if hasattr(os, "symlink"): def test_realpath_basic(self): # Basic operation.