import hooks (PEP 302) broken in Python >=2.5?

Ryan Kelly ryan at
Sun Aug 7 18:03:22 EDT 2011

On Sun, 2011-08-07 at 11:11 -0700, Josh Haberman wrote:
> When reading about import hooks, I came across a blog entry comment
> that says:
>   One additional thing to note about ihooks is that it's
>   somewhat seriously broken on Python 2.5 and newer and there
>   seems to be little or no interest in fixing it. It's
>   probably worth *always* avoiding when writing new code.
> --
> Does anyone know what this is referring to?  Should I be wary of
> relying on import hooks?

I believe that comment is referring specifically to "ihooks" the stdlib
module, not "import hooks" the general concept as defined in PEP302.
The former pre-dates the later.

I use custom PEP302 loaders all the time and they work fine in at least
2.6, 2.7 and 3.2.


Ryan Kelly  |  This message is digitally signed. Please visit
ryan at        | for details

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the Python-list mailing list