mirror of
https://github.com/python/cpython.git
synced 2025-10-21 00:44:12 +00:00
GH-104102: Optimize pathlib.Path.glob()
handling of ../
pattern segments (GH-104103)
These segments do not require a `stat()` call, as the selector's `_select_from()` method is called after we've established that the parent is a directory.
This commit is contained in:
parent
47770a1e91
commit
65a49c6553
3 changed files with 19 additions and 0 deletions
|
@ -1892,8 +1892,13 @@ def test_glob_dotdot(self):
|
|||
P = self.cls
|
||||
p = P(BASE)
|
||||
self.assertEqual(set(p.glob("..")), { P(BASE, "..") })
|
||||
self.assertEqual(set(p.glob("../..")), { P(BASE, "..", "..") })
|
||||
self.assertEqual(set(p.glob("dirA/..")), { P(BASE, "dirA", "..") })
|
||||
self.assertEqual(set(p.glob("dirA/../file*")), { P(BASE, "dirA/../fileA") })
|
||||
self.assertEqual(set(p.glob("dirA/../file*/..")), set())
|
||||
self.assertEqual(set(p.glob("../xyzzy")), set())
|
||||
self.assertEqual(set(p.glob("xyzzy/..")), set())
|
||||
self.assertEqual(set(p.glob("/".join([".."] * 50))), { P(BASE, *[".."] * 50)})
|
||||
|
||||
@os_helper.skip_unless_symlink
|
||||
def test_glob_permissions(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue