[issue1576] First draft of a post import hook

Phillip J. Eby report at bugs.python.org
Sun Dec 9 22:06:17 CET 2007

Phillip J. Eby added the comment:

It also needs to hold the import lock during both the "register" and 
"notify" operations.  In addition, the "notify" operation needs to be 
exposed for calling from Python (so that lazy module implementations 
can interop).  Finally, it's not clear to me whether there's any way 
one of the import APIs can exit with the module added to sys.modules, 
but *without* the notify operation being called.  It seems to me that 
those code paths were cleared up in 2.4 (i.e. failure to import 
causes the module to be removed from sys.modules), but it might be 
good to doublecheck that.

Tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list