mirror of
https://github.com/python/cpython.git
synced 2025-12-09 02:35:14 +00:00
GH-89769: pathlib.Path.glob(): do not follow symlinks when checking for precise match (GH-29655)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
This commit is contained in:
parent
c7c3a60c88
commit
af886ffa06
4 changed files with 25 additions and 9 deletions
|
|
@ -1700,6 +1700,8 @@ class _BasePathTest(object):
|
|||
self.assertIs(True, (p / 'linkB').exists())
|
||||
self.assertIs(True, (p / 'linkB' / 'fileB').exists())
|
||||
self.assertIs(False, (p / 'linkA' / 'bah').exists())
|
||||
self.assertIs(False, (p / 'brokenLink').exists())
|
||||
self.assertIs(True, (p / 'brokenLink').exists(follow_symlinks=False))
|
||||
self.assertIs(False, (p / 'foo').exists())
|
||||
self.assertIs(False, P('/xyzzy').exists())
|
||||
self.assertIs(False, P(BASE + '\udfff').exists())
|
||||
|
|
@ -1806,6 +1808,8 @@ class _BasePathTest(object):
|
|||
_check(p.glob("*/fileB"), ['dirB/fileB'])
|
||||
else:
|
||||
_check(p.glob("*/fileB"), ['dirB/fileB', 'linkB/fileB'])
|
||||
if os_helper.can_symlink():
|
||||
_check(p.glob("brokenLink"), ['brokenLink'])
|
||||
|
||||
if not os_helper.can_symlink():
|
||||
_check(p.glob("*/"), ["dirA", "dirB", "dirC", "dirE"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue