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).
This commit is contained in:
Brett Cannon 2013-03-13 11:09:08 -07:00
parent 542308eae7
commit 327992330e
4 changed files with 26 additions and 1 deletions

View file

@ -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)