[Python-Dev] regrtest.py mystery (original) (raw)

Fredrik Lundh fredrik@pythonware.com
Tue, 18 Dec 2001 00:14:43 +0100


greg wrote:

> He deemed the situation where M is loaded-but-missing-from-sys.modules > to be even worse than for M to be left loaded-but-broken therein. Maybe modules should have a this-module-is-broken flag which is set when the module fails to import properly, and which causes an exception on any further attempt to reference a name in it.

how do you detect that a module is successfully imported?

the only way I can think of is "execution reached the end of the module", which would probably break considerable amounts of code that rely on "temporarily recursive" imports.