Commit 20d6407a authored by Batuhan Taskaya's avatar Batuhan Taskaya

Allow calling get_frozen_object without paths, raise ImportError when it cant find module

parent 82689e1a
...@@ -60,11 +60,15 @@ def find_module(module, paths=None): ...@@ -60,11 +60,15 @@ def find_module(module, paths=None):
return file, path, (suffix, mode, kind) return file, path, (suffix, mode, kind)
def get_frozen_object(module, paths): def get_frozen_object(module, paths=None):
spec = importlib.util.find_spec(module, paths) spec = importlib.util.find_spec(module, paths)
return spec.loader.get_code(_resolve(module)) if not spec:
raise ImportError("Can't find %s" % module)
return spec.loader.get_code(module)
def get_module(module, paths, info): def get_module(module, paths, info):
spec = importlib.util.find_spec(module, paths) spec = importlib.util.find_spec(module, paths)
if not spec:
raise ImportError("Can't find %s" % module)
return module_from_spec(spec) return module_from_spec(spec)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment