Commit bbf825ee authored by Ondřej Súkup's avatar Ondřej Súkup Committed by GitHub

Fix _imp module behaviour if is defined paths in find_spec call

fixes #1896
parent 55994609
......@@ -19,6 +19,9 @@ PY_FROZEN = 7
def find_module(module, paths=None):
"""Just like 'imp.find_module()', but with package support"""
if isinstance(paths, list):
spec = importlib.machinery.PathFinder().find_spec(module, paths)
else:
spec = importlib.util.find_spec(module, paths)
if spec is None:
raise ImportError("Can't find %s" % module)
......@@ -60,6 +63,9 @@ def find_module(module, paths=None):
def get_frozen_object(module, paths=None):
if isinstance(paths, list):
spec = importlib.machinery.PathFinder().find_spec(module, paths)
else:
spec = importlib.util.find_spec(module, paths)
if not spec:
raise ImportError("Can't find %s" % module)
......@@ -67,6 +73,9 @@ def get_frozen_object(module, paths=None):
def get_module(module, paths, info):
if isinstance(paths, list):
spec = importlib.machinery.PathFinder().find_spec(module, paths)
else:
spec = importlib.util.find_spec(module, paths)
if not spec:
raise ImportError("Can't find %s" % module)
......
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