Message165004
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). |
|
Date |
User |
Action |
Args |
2012-07-08 11:33:22 | ncoghlan | set | recipients:
+ ncoghlan, brett.cannon, iko, docs@python |
2012-07-08 11:33:22 | ncoghlan | set | messageid: <1341747202.2.0.101298880199.issue15292@psf.upfronthosting.co.za> |
2012-07-08 11:33:21 | ncoghlan | link | issue15292 messages |
2012-07-08 11:33:21 | ncoghlan | create | |
|