Skip to content

Commit b5f3ae5

Browse files
committed
Use importlib.util.spec_from_loader in find_spec
1 parent dd1453b commit b5f3ae5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pkg_resources/extern/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import importlib.machinery
1+
import importlib.util
22
import sys
33

44

@@ -57,7 +57,7 @@ def exec_module(self, module):
5757
def find_spec(self, fullname, path=None, target=None):
5858
"""Return a module spec for vendored names."""
5959
return (
60-
importlib.machinery.ModuleSpec(fullname, self)
60+
importlib.util.spec_from_loader(fullname, self)
6161
if self._module_matches_namespace(fullname) else None
6262
)
6363

setuptools/extern/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import importlib.machinery
1+
import importlib.util
22
import sys
33

44

@@ -57,7 +57,7 @@ def exec_module(self, module):
5757
def find_spec(self, fullname, path=None, target=None):
5858
"""Return a module spec for vendored names."""
5959
return (
60-
importlib.machinery.ModuleSpec(fullname, self)
60+
importlib.util.spec_from_loader(fullname, self)
6161
if self._module_matches_namespace(fullname) else None
6262
)
6363

0 commit comments

Comments
 (0)