[Python-Dev] Pointers to python-dev threads pertaining to Patch #441791?

Guido van Rossum guido@digicool.com
Fri, 20 Jul 2001 15:48:23 -0400


http://sourceforge.net/tracker/?group_id=5470&atid=305470&func=detail&aid=441791

> > In any case, I agree it would be nice if this was fixed.  
> 
> Import issues are subtle, but this looks good to me.

I've added my own version to the patch, which does the right thing if
the module has a SyntaxError, and also conforms to the style guide
(PEP 7).

> > Maybe Thomas was thinking of a different issue, where some people
> > want the sys.modules[name] entry to be *removed* when an import
> > fails.  I am not for that change, but I haven't recovered the
> > reason (I know I had a good one when I implemented things this
> > way).
> 
> Perhaps one could construct a situation with circular imports 
> in which one module ends up with a name (and no error, 
> because the name is being imported) that later turns into an 
> error?

Yes, that's the one (Moshe remembered this too in private mail).

> There's also the issue of failed relative imports that succeed 
> as absolute imports - you don't want every module in the 
> package hunting around for package.sys.

That's a different issue; those create None entries in sys.modules,
and obviously those None entries shouldn't be removed on failure.

--Guido van Rossum (home page: http://www.python.org/~guido/)