Nick Coghlan <ncogh...@gmail.com> added the comment:

The PyPy and 3.3 behaviour are actually correct according to the spec, but it's 
*really* unclear in PEP 302.

sys.meta_path accepts finder objects. These are explicitly documented as 
returning "None" from find_module() to indicate "try the next one" and raising 
exceptions solely to report problems.

However, for reasons that are unknown to me, sys.path_hooks entries (which 
occupy most of the section on registering hooks) use a different protocol to 
indicate "try the next one": raising ImportError.

Since meta_path and path_hooks are described in the same section, and the 
meta_path description just says "add finder objects", it's understandable that 
implementors take the path_hooks protocol description as applying to finders in 
general :(

I would chalk the 2.x (and likely 3.x for x < 3) behaviour up to the only 
partial implementation of PEP 302 in CPython (until Brett's success in 
bootstrapping importlib for 3.3).

----------

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

Reply via email to