aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBatuhan Taskaya <batuhanosmantaskaya@gmail.com>2019-10-29 10:51:54 +0300
committerBatuhan Taskaya <batuhanosmantaskaya@gmail.com>2019-10-29 10:51:54 +0300
commit20d6407aa5f68dbeba61e8967290f2fbde4f85ab (patch)
treef30f577fe77de1f0e5ceb148cd46eec0177503ab
parent82689e1aa8e6548f26f2ce3bcd069411cb39bfcf (diff)
downloadexternal_python_setuptools-20d6407aa5f68dbeba61e8967290f2fbde4f85ab.tar.gz
external_python_setuptools-20d6407aa5f68dbeba61e8967290f2fbde4f85ab.tar.bz2
external_python_setuptools-20d6407aa5f68dbeba61e8967290f2fbde4f85ab.zip
Allow calling get_frozen_object without paths, raise ImportError when it cant find module
-rw-r--r--setuptools/_imp.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/setuptools/_imp.py b/setuptools/_imp.py
index ee719c9a..ab29ef21 100644
--- a/setuptools/_imp.py
+++ b/setuptools/_imp.py
@@ -60,11 +60,15 @@ def find_module(module, paths=None):
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)
- 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):
spec = importlib.util.find_spec(module, paths)
+ if not spec:
+ raise ImportError("Can't find %s" % module)
return module_from_spec(spec)