summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/__init__.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-03-13 18:09:08 (GMT)
committerBrett Cannon <brett@python.org>2013-03-13 18:09:08 (GMT)
commit327992330e13cd6663faa8400f9ff46daab828b0 (patch)
tree922c440ad749973a0d7cef94ffc46eae0ddaa92b /Lib/importlib/__init__.py
parent542308eae7a95ae62aa1bc8e8c6c2f8a3695ae34 (diff)
downloadcpython-327992330e13cd6663faa8400f9ff46daab828b0.zip
cpython-327992330e13cd6663faa8400f9ff46daab828b0.tar.gz
cpython-327992330e13cd6663faa8400f9ff46daab828b0.tar.bz2
Issue #17099: Have importlib.find_loader() raise ValueError when
__loader__ is not set on a module. This brings the exception in line with when __loader__ is None (which is equivalent to not having the attribute defined).
Diffstat (limited to 'Lib/importlib/__init__.py')
-rw-r--r--Lib/importlib/__init__.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py
index 22c90f2..d07f02e 100644
--- a/Lib/importlib/__init__.py
+++ b/Lib/importlib/__init__.py
@@ -68,6 +68,8 @@ def find_loader(name, path=None):
return loader
except KeyError:
pass
+ except AttributeError:
+ raise ValueError('{}.__loader__ is not set'.format(name))
return _bootstrap._find_module(name, path)