mirror of
https://github.com/python/cpython.git
synced 2026-02-14 11:21:01 +00:00
The implementation of `Path.glob()` does rather a hacky thing: it calls `self.with_segments()` to convert the given pattern to a `Path` object, and then peeks at the private `_raw_path` attribute to see if pathlib removed a trailing slash from the pattern. In this patch, we make `glob()` use a new `_parse_pattern()` classmethod that splits the pattern into parts while preserving information about any trailing slash. This skips the cost of creating a `Path` object, and avoids some path anchor normalization, which makes `Path.glob()` slightly faster. But mostly it's about making the code less naughty. Co-authored-by: Tomas R. <tomas.roun8@gmail.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| _abc.py | ||
| _local.py | ||
| _os.py | ||