Skip to content

Commit 7aacb5b

Browse files
committed
avoid having to import in the CachedImportFinder
1 parent 70a3305 commit 7aacb5b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

graalpython/lib-graalpython/_frozen_importlib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@ def load(suffix=""):
5555
sys.modules["builtins"].__import__ = __builtin__(importlib.__import__)
5656

5757
# Insert our meta finder for caching
58+
_imp.CachedImportFinder.ModuleSpec = importlib.ModuleSpec
5859
sys.meta_path.insert(0, _imp.CachedImportFinder)

graalpython/lib-graalpython/_imp.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ def freeze_module(mod, key=None):
135135
class CachedImportFinder:
136136
@staticmethod
137137
def find_spec(fullname, path, target=None):
138-
from _frozen_importlib import ModuleSpec
139138
path = _unpatch_package_paths(graal_python_get_cached_code_path(fullname))
140139
if path is not None:
141140
if len(path) > 0:
@@ -144,7 +143,7 @@ def find_spec(fullname, path, target=None):
144143
else:
145144
submodule_search_locations = None
146145
is_package = False
147-
spec = ModuleSpec(fullname, CachedLoader, is_package=is_package)
146+
spec = CachedImportFinder.ModuleSpec(fullname, CachedLoader, is_package=is_package)
148147
# we're not setting origin, so the module won't have a __file__
149148
# attribute and will show up as built-in
150149
spec.submodule_search_locations = submodule_search_locations

0 commit comments

Comments
 (0)