Eric Snow added the comment:

My vote is for making this a ValueError in both cases (and amending the doc 
appropriately as well).  The error amounts to the same thing: the module did 
not have loader (implicitly or explicitly).  If someone wants to distinguish 
between the two they can explicitly check __loader__ on the module.

Incidently, _find_and_load_unlocked() has similar code to find_loader() 
(Lib/importlib/_bootstrap:1523) and raises ImportError instead of ValueError.  
That's actually fine since it's a different situation.  However, _find_module() 
does not handle when __loader__ does not exist, so you would get neither 
ValueError nor ImportError.  I expect we'd want it or _find_and_load_unlocked() 
to convert the AttributeError into ImportError to be consistent both with the 
fix for this issue and with how we handle the __loader__ == None case there.

---

For reference, here is the original python-dev thread:

  http://mail.python.org/pipermail/python-dev/2013-January/123777.html

The reference to ValueError is in the importlib docs:

  http://docs.python.org/dev/library/importlib.html#importlib.find_loader

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17099>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to