Index: src/org/python/core/imp.java =================================================================== --- src/org/python/core/imp.java (revision 2837) +++ src/org/python/core/imp.java (working copy) @@ -182,8 +182,16 @@ if (c instanceof PyTableCode) { code = (PyTableCode) c; } - PyFrame f = new PyFrame(code, module.__dict__, module.__dict__, null); - code.call(f); + try { + PyFrame f = new PyFrame(code, + module.__dict__, + module.__dict__, + null); + code.call(f); + } catch(RuntimeException t) { + Py.getSystemState().modules.__delitem__(name.intern()); + throw t; + } return module; }