### Eclipse Workspace Patch 1.0 #P jython-trunk Index: src/org/python/util/jython.java =================================================================== --- src/org/python/util/jython.java (revision 7164) +++ src/org/python/util/jython.java (working copy) @@ -98,7 +98,7 @@ throw Py.ValueError("jar file missing '__run__.py'"); } - PyStringMap locals = new PyStringMap(); + PyStringMap locals = Py.newStringMap(); // Stripping the stuff before the last File.separator fixes Bug #931129 by // keeping illegal characters out of the generated proxy class name Index: src/org/python/core/PyType.java =================================================================== --- src/org/python/core/PyType.java (revision 7109) +++ src/org/python/core/PyType.java (working copy) @@ -1201,6 +1201,10 @@ return createType(c, needsInners); } + static boolean hasBuilder(Class c) { + return classToBuilder.containsKey(c); + } + private static TypeBuilder getBuilder(Class c) { if (classToBuilder == null) { // PyType itself has yet to be initialized. This should be a bootstrap type, so it'll Index: src/org/python/core/Py.java =================================================================== --- src/org/python/core/Py.java (revision 7113) +++ src/org/python/core/Py.java (working copy) @@ -576,6 +576,14 @@ return new PyString(s); } + public static PyStringMap newStringMap() { + // enable lazy bootstrapping (see issue #1671) + if (!PyType.hasBuilder(PyStringMap.class)) { + BOOTSTRAP_TYPES.add(PyStringMap.class); + } + return new PyStringMap(); + } + public static PyUnicode newUnicode(char c) { return (PyUnicode) makeCharacter(c, true); } Index: src/org/python/util/PythonInterpreter.java =================================================================== --- src/org/python/util/PythonInterpreter.java (revision 7113) +++ src/org/python/util/PythonInterpreter.java (working copy) @@ -94,7 +94,7 @@ protected PythonInterpreter(PyObject dict, PySystemState systemState, boolean useThreadLocalState) { if (dict == null) { - dict = new PyStringMap(); + dict = Py.newStringMap(); } globals = dict; Index: src/org/python/util/PyServlet.java =================================================================== --- src/org/python/util/PyServlet.java (revision 6980) +++ src/org/python/util/PyServlet.java (working copy) @@ -121,7 +121,7 @@ protected static PythonInterpreter createInterpreter(ServletContext servletContext) { String rootPath = getRootPath(servletContext); PySystemState sys = new PySystemState(); - PythonInterpreter interp = new PythonInterpreter(new PyStringMap(), sys); + PythonInterpreter interp = new PythonInterpreter(Py.newStringMap(), sys); sys.path.append(new PyString(rootPath)); String modulesDir = rootPath + "WEB-INF" + File.separator + "jython";