From: <pj...@us...> - 2009-05-30 21:20:12
|
Revision: 6429 http://jython.svn.sourceforge.net/jython/?rev=6429&view=rev Author: pjenvey Date: 2009-05-30 21:20:11 +0000 (Sat, 30 May 2009) Log Message: ----------- ensure open file handles are closed Modified Paths: -------------- trunk/jython/Lib/test/test_classpathimporter.py trunk/jython/src/org/python/core/util/importer.java Modified: trunk/jython/Lib/test/test_classpathimporter.py =================================================================== --- trunk/jython/Lib/test/test_classpathimporter.py 2009-05-30 06:49:08 UTC (rev 6428) +++ trunk/jython/Lib/test/test_classpathimporter.py 2009-05-30 21:20:11 UTC (rev 6429) @@ -68,7 +68,6 @@ os.path.join(compile_path, 'jar_pkg', 'prefer_compiled$py.class')) zip.close() - zip = zipfile.ZipFile(jar) Thread.currentThread().contextClassLoader = test_support.make_jar_classloader(jar) import flat_in_jar Modified: trunk/jython/src/org/python/core/util/importer.java =================================================================== --- trunk/jython/src/org/python/core/util/importer.java 2009-05-30 06:49:08 UTC (rev 6428) +++ trunk/jython/src/org/python/core/util/importer.java 2009-05-30 21:20:11 UTC (rev 6429) @@ -188,16 +188,19 @@ Bundle bundle = makeBundle(searchPath, tocEntry); byte[] codeBytes; - if (isbytecode) { - try { - codeBytes = imp.readCode(fullname, bundle.inputStream, true); - } catch (IOException ioe) { - throw Py.ImportError(ioe.getMessage() + "[path=" + fullSearchPath + "]"); + try { + if (isbytecode) { + try { + codeBytes = imp.readCode(fullname, bundle.inputStream, true); + } catch (IOException ioe) { + throw Py.ImportError(ioe.getMessage() + "[path=" + fullSearchPath + "]"); + } + } else { + codeBytes = imp.compileSource(fullname, bundle.inputStream, fullSearchPath); } - } else { - codeBytes = imp.compileSource(fullname, bundle.inputStream, fullSearchPath); + } finally { + bundle.close(); } - bundle.close(); if (codeBytes == null) { // bad magic number or non-matching mtime in byte code, try next This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |