GH-116380: Revert move of pathlib globbing code to pathlib._glob (#118678)

The previous change made the `glob` module slower to import, because it
imported `pathlib._glob` and hence the rest of `pathlib`.

Reverts a40f557d7b.
This commit is contained in:
Barney Gale 2024-05-07 01:32:48 +01:00 committed by GitHub
parent ff6cbb2503
commit b4bdf83cc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 331 additions and 337 deletions

View file

@ -5,6 +5,7 @@ import os
import posixpath
import sys
import warnings
from glob import _StringGlobber
from itertools import chain
from _collections_abc import Sequence
@ -18,7 +19,6 @@ except ImportError:
grp = None
from ._abc import UnsupportedOperation, PurePathBase, PathBase
from ._glob import StringGlobber
__all__ = [
@ -102,7 +102,7 @@ class PurePath(PurePathBase):
'_hash',
)
parser = os.path
_globber = StringGlobber
_globber = _StringGlobber
def __new__(cls, *args, **kwargs):
"""Construct a PurePath from one or several strings and or existing