diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index da7942775f3..34d246002f8 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -125,7 +125,6 @@ if TYPE_CHECKING: from _typeshed import StrPath - from types import _LoaderProtocol T = TypeVar("T") # Type aliases @@ -137,6 +136,8 @@ # Any object works, but let's indicate we expect something like a module (optionally has __loader__ or __file__) _ModuleLike = Union[object, types.ModuleType] _AdapterType = Callable[..., Any] # Incomplete +# Use _typeshed.importlib.LoaderProtocol once available https://github.com/python/typeshed/pull/11890 +_LoaderProtocol = Any # Incomplete _PEP440_FALLBACK = re.compile(r"^v?(?P(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.I) diff --git a/pkg_resources/extern/__init__.py b/pkg_resources/extern/__init__.py index 90bb8741d50..96b596ace29 100644 --- a/pkg_resources/extern/__init__.py +++ b/pkg_resources/extern/__init__.py @@ -70,7 +70,7 @@ def find_spec( ): """Return a module spec for vendored names.""" return ( - # https://github.com/python/typeshed/issues/11882 + # This should fix itself next mypy release https://github.com/python/typeshed/pull/11890 importlib.util.spec_from_loader(fullname, self) # type: ignore[arg-type] if self._module_matches_namespace(fullname) else None