Message181356
| Author |
eric.snow |
| Recipients |
asvetlov, barry, brett.cannon, eric.snow, ncoghlan, theller |
| Date |
2013年02月04日.17:49:57 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1360000198.24.0.77962898267.issue17099@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 |
|