Issue837308

classification
Title: Importing bug
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, leouserz, nwbrown
Priority: low Keywords:

Created on 2003-11-06.16:02:43 by nwbrown, last changed 2007-07-10.15:48:47 by cgroves.

Messages
msg872 (view) Author: Nicholas Brown (nwbrown) Date: 2003-11-06.16:02:43
If you try to import a module that does not exist,
Jython will return an import error (as expected).  But
if you then create that module and try again without
restarting Jython, you get the same error (CPython will
allow this).  In order to get that module Jython must
be restarted.  This can be an annoyance when using the
interactive session, and can be a complete pain when
using something like STAX which keeps Jython running in
the background to make requests to.
msg873 (view) Author: Deleted User leouserz (leouserz) Date: 2007-01-15.15:17:25
The problem appears to be that "imp" in its import_name method is setting the name of the module to Py.None if it can't find it the first time.  This causes the system to block the import from that point onward:
        if (topMod == Py.None || topMod == null) {

            if (topMod == null) {

                modules.__setitem__(parentNameBuffer.toString().intern(),

                        Py.None);

            }

            parentNameBuffer = new StringBuffer("");

            // could throw ImportError

            topMod = import_first(firstName, parentNameBuffer, name, fromlist);

        }


The question is, if this changed, what is going to be broken...
msg874 (view) Author: Charlie Groves (cgroves) Date: 2007-07-10.15:48:47
This is the same as http://jython.org/bugs/1747092, so it was fixed in r3287.  Unfortunate that I rediscovered the spot to fix it after Leo already did it.
History
Date User Action Args
2003-11-06 16:02:43nwbrowncreate