summaryrefslogtreecommitdiffstats
path: root/Lib/pkgutil.py
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2014-04-19 06:13:23 (GMT)
committerEric Snow <ericsnowcurrently@gmail.com>2014-04-19 06:13:23 (GMT)
commit658af3137237407549e71cc1c3a3dd4f2c86b675 (patch)
tree5966ba969f867c851131bc67f68936ac3f6b23f0 /Lib/pkgutil.py
parentbddecc386123409c6b16cf931c1b175ded07bfcd (diff)
downloadcpython-658af3137237407549e71cc1c3a3dd4f2c86b675.zip
cpython-658af3137237407549e71cc1c3a3dd4f2c86b675.tar.gz
cpython-658af3137237407549e71cc1c3a3dd4f2c86b675.tar.bz2
Issue #21200: Return None from pkgutil.get_loader() when __spec__ is missing.
Diffstat (limited to 'Lib/pkgutil.py')
-rw-r--r--Lib/pkgutil.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py
index 58cccdc..e42b6eb 100644
--- a/Lib/pkgutil.py
+++ b/Lib/pkgutil.py
@@ -461,6 +461,8 @@ def get_loader(module_or_name):
loader = getattr(module, '__loader__', None)
if loader is not None:
return loader
+ if getattr(module, '__spec__', None) is None:
+ return None
fullname = module.__name__
else:
fullname = module_or_name