import foo # where foo is a dynamically loaded module
causes a core dump, at least on systems using SVR4 shared libraries
for dynamic module loading.
raises ImportError: No module named math
does not actually seem to fail but looks very scary because stdwin
cannot be initialized twice in the same process.
In Python version 1.0.1++ (to be released as 1.0.2) I've added the
- Calling reload() for dynamically loaded modules (case 1) is
forbidden and raises an ImportError
- Ditto for built-in modules (case 3)
- Attempts to force a reinitialization of a few privileged built-in
modules like sys, __main__ and __builtin__ by deleting them from
sys.modules (case 2) raises ImportError
- Similar attempts for non-privileged built-in modules (case 4) are
not caught. This may still dump core depending on whether the
module's init*() function can be called more than once or not.
(Forbidding this would require more work as it would require
maintaining a table of flags telling whether a particular module was
- Calling reload() for frozen modules is fixed and should now work as
expected (except I haven't tested it yet :).
--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>