mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
GH-113225: Speed up pathlib._abc.PathBase.glob()
(#113556)
`PathBase._scandir()` is implemented using `iterdir()`, so we can use its results directly, rather than passing them through `_make_child_relpath()`.
This commit is contained in:
parent
db1c882239
commit
b664d91599
2 changed files with 12 additions and 5 deletions
|
@ -299,6 +299,10 @@ class Path(_abc.PathBase, PurePath):
|
|||
def _scandir(self):
|
||||
return os.scandir(self)
|
||||
|
||||
def _make_child_entry(self, entry):
|
||||
# Transform an entry yielded from _scandir() into a path object.
|
||||
return self._make_child_relpath(entry.name)
|
||||
|
||||
def absolute(self):
|
||||
"""Return an absolute version of this path
|
||||
No normalization or symlink resolution is performed.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue