From: <pj...@us...> - 2008-08-06 18:45:55
|
Revision: 5096 http://jython.svn.sourceforge.net/jython/?rev=5096&view=rev Author: pjenvey Date: 2008-08-06 18:45:50 +0000 (Wed, 06 Aug 2008) Log Message: ----------- fix zipimport not handling mismatched APIVersion, and imp.load_module not handling it either for packages Modified Paths: -------------- branches/asm/src/org/python/modules/imp.java branches/asm/src/org/python/modules/zipimport/zipimporter.java Modified: branches/asm/src/org/python/modules/imp.java =================================================================== --- branches/asm/src/org/python/modules/imp.java 2008-08-06 18:15:17 UTC (rev 5095) +++ branches/asm/src/org/python/modules/imp.java 2008-08-06 18:45:50 UTC (rev 5096) @@ -212,7 +212,7 @@ m.__dict__.__setitem__("__path__", new PyList(new PyObject[] { filename })); m.__dict__.__setitem__("__file__", filename); - ModuleInfo mi = findFromSource(name, filename.toString(), true, false); + ModuleInfo mi = findFromSource(name, filename.toString(), true, true); type = mi.type; file = mi.file; filename = new PyString(mi.filename); Modified: branches/asm/src/org/python/modules/zipimport/zipimporter.java =================================================================== --- branches/asm/src/org/python/modules/zipimport/zipimporter.java 2008-08-06 18:15:17 UTC (rev 5095) +++ branches/asm/src/org/python/modules/zipimport/zipimporter.java 2008-08-06 18:45:50 UTC (rev 5096) @@ -417,11 +417,13 @@ } zipBundle.close(); + if (codeBytes == null) { + // bad magic number or non-matching mtime in byte code, try next + continue; + } + imp.cacheCompiledSource(pathToEntry, null, codeBytes); PyCode code = BytecodeLoader.makeCode(fullname + "$py", codeBytes, pathToEntry); - if (code == null) { - continue; - } return new ModuleCodeData(code, ispackage, pathToEntry); } return null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |