SIGN IN SIGN UP

GH-117586: Speed up `pathlib.Path.glob()` by working with strings (#117589)

Move pathlib globbing implementation into a new private class: `glob._Globber`. This class implements fast string-based globbing. It's called by `pathlib.Path.glob()`, which then converts strings back to path objects.

In the private pathlib ABCs, add a `pathlib._abc.Globber` subclass that works with `PathBase` objects rather than strings, and calls user-defined path methods like `PathBase.stat()` rather than `os.stat()`.

This sets the stage for two more improvements:

- GH-115060: Query non-wildcard segments with `lstat()`
- GH-116380: Unify `pathlib` and `glob` implementations of globbing.

No change to the implementations of `glob.glob()` and `glob.iglob()`.
B
Barney Gale committed
6258844c27e3b5a43816e7c559089a5fe0a47123
Parent: 689ada7
Committed by GitHub <noreply@github.com> on 4/10/2024, 7:43:07 PM