cpython: 36864abbfe02 (original) (raw)

Mercurial > cpython

changeset 99780:36864abbfe02

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

Guido van Rossum guido@dropbox.com
date Wed, 06 Jan 2016 10:36:19 -0800
parents f6ae90450a4d(current diff)9826dbad1252(diff)
children d5f96a5da219
files 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 @@ -128,6 +128,9 @@ Core and Builtins Library ------- +- Issue #26012: Don't traverse into symlinks for ** pattern in