cpython: 9826dbad1252 (original) (raw)

Mercurial > cpython

changeset 99779:9826dbad1252 3.5

Issue #26012: Don't traverse into symlinks for ** pattern in pathlib.Path.[r]glob(). (Merge 3.4->3.5) [#26012]

Guido van Rossum guido@python.org
date Wed, 06 Jan 2016 10:35:30 -0800
parents 224a026b4ca1(current diff)18f5b125a863(diff)
children 36864abbfe02 9c49c417a68a
files Lib/pathlib.py Lib/test/test_pathlib.py Misc/NEWS
diffstat 3 files changed, 22 insertions(+), 2 deletions(-)[+] [-] Lib/pathlib.py 2 Lib/test/test_pathlib.py 19 Misc/NEWS 3

line wrap: on

line diff

--- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -541,7 +541,7 @@ class _RecursiveWildcardSelector(_Select yield parent_path for name in listdir(parent_path): path = parent_path._make_child_relpath(name)

--- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -1241,7 +1241,7 @@ class _BasePathTest(object): os.symlink('non-existing', join('brokenLink')) self.dirlink('dirB', join('linkB')) self.dirlink(os.path.join('..', 'dirB'), join('dirA', 'linkC'))

if os.name == 'nt': @@ -1437,6 +1437,23 @@ class _BasePathTest(object): _check(p.rglob("file*"), ["dirC/fileC", "dirC/dirD/fileD"]) _check(p.rglob("/"), ["dirC/dirD/fileD"])

+ def test_glob_dotdot(self): # ".." is not special in globs P = self.cls

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -41,6 +41,9 @@ Core and Builtins Library ------- +- Issue #26012: Don't traverse into symlinks for ** pattern in