Index: jython/src/org/python/core/imp.java =================================================================== --- jython/src/org/python/core/imp.java (revision 3142) +++ jython/src/org/python/core/imp.java (working copy) @@ -133,7 +133,7 @@ * compiledFilename couldn't be determined of if an error was thrown * while writing to the cache file. */ - private static String cacheCompiledSource(String sourceFilename, + public static String cacheCompiledSource(String sourceFilename, String compiledFilename, byte[] compiledSource) { if(compiledFilename == null){ Index: jython/src/org/python/modules/py_compile.java =================================================================== --- jython/src/org/python/modules/py_compile.java (revision 3142) +++ jython/src/org/python/modules/py_compile.java (working copy) @@ -10,21 +10,32 @@ }); - public static void compile(String filename, String cfile) { - compile(filename, cfile, null); + public static boolean compile(String filename, String cfile) { + return compile(filename, cfile, null); } - public static void compile(String filename) { - compile(filename, null, null); + public static boolean compile(String filename) { + return compile(filename, null, null); } - public static void compile(String filename, String cfile, String dfile) { + public static boolean compile(String filename, String cfile, String dfile) + { File file = new File(filename); String name = file.getName(); int dot = name.lastIndexOf('.'); if (dot != -1) { name = name.substring(0, dot); } - org.python.core.imp.compileSource(name, file, dfile, cfile); + byte[] bytes=org.python.core.imp.compileSource(name, file, + dfile, cfile); + + // write the compiled code to disk: + org.python.core.imp.cacheCompiledSource(filename, null, bytes); + + if (bytes.length>0) { + return true; + } else { + return false; + } } }