Skip to content

Commit

Permalink
Use importlib.util.spec_from_loader in find_spec
Browse files Browse the repository at this point in the history
  • Loading branch information
webknjaz committed Apr 8, 2021
1 parent dd1453b commit b5f3ae5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg_resources/extern/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import importlib.machinery
import importlib.util
import sys


Expand Down Expand Up @@ -57,7 +57,7 @@ def exec_module(self, module):
def find_spec(self, fullname, path=None, target=None):
"""Return a module spec for vendored names."""
return (
importlib.machinery.ModuleSpec(fullname, self)
importlib.util.spec_from_loader(fullname, self)
if self._module_matches_namespace(fullname) else None
)

Expand Down
4 changes: 2 additions & 2 deletions setuptools/extern/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import importlib.machinery
import importlib.util
import sys


Expand Down Expand Up @@ -57,7 +57,7 @@ def exec_module(self, module):
def find_spec(self, fullname, path=None, target=None):
"""Return a module spec for vendored names."""
return (
importlib.machinery.ModuleSpec(fullname, self)
importlib.util.spec_from_loader(fullname, self)
if self._module_matches_namespace(fullname) else None
)

Expand Down

0 comments on commit b5f3ae5

Please sign in to comment.