[Python-Dev] Pointers to python-dev threads pertaining to Patch #441791?
Guido van Rossum
guido@digicool.com
Fri, 20 Jul 2001 09:41:45 -0400
> Hi, I posted a patch recently, #441791, causing "import foo.bar" to set
> "sys.modules['foo'].bar = sys.modules['foo.bar']" even if an error is
> raised during the importing of bar. With this patch, import commands
> like "import foo.bar; reload(foo.bar)" work in a fashion more consistent
> with the way "import unpackaged_module; reload(unpackaged_module)"
> works.
>
> Thomas Wouters posted a reply saying that this has been discussed on
> python-dev before. I've searched the archives for the keywords
> "import.c", "import_submodule" (the function I modify,) and "package
> import" but didn't turn up anything relevant. Could someone point me at
> a thread which discusses this? This patch has proved very useful to me,
> as I tend to carry around a lot of data in long-running python process,
> and being able to reload submodules of a package has been very useful to
> me. It'd be nice if the patch got into python itself, so that I can
> retain my development habits without having to keep an eye on
> import.c. :)
I hardly recall such a discussion, and I don't think that much light
was shed on the situation.
In any case, I agree it would be nice if this was fixed. But I'm too
busy to look into this myself -- sorry.
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).
--Guido van Rossum (home page: http://www.python.org/~guido/)