|
From: <otm...@us...> - 2010-11-09 22:55:22
|
Revision: 7170
http://jython.svn.sourceforge.net/jython/?rev=7170&view=rev
Author: otmarhumbel
Date: 2010-11-09 22:55:15 +0000 (Tue, 09 Nov 2010)
Log Message:
-----------
allow PyStringMap to be bootstrapped without a warning;
fixes issue #1671
Modified Paths:
--------------
trunk/jython/src/org/python/core/Py.java
trunk/jython/src/org/python/core/PyType.java
trunk/jython/src/org/python/util/PyServlet.java
trunk/jython/src/org/python/util/PythonInterpreter.java
trunk/jython/src/org/python/util/jython.java
Modified: trunk/jython/src/org/python/core/Py.java
===================================================================
--- trunk/jython/src/org/python/core/Py.java 2010-11-06 00:15:33 UTC (rev 7169)
+++ trunk/jython/src/org/python/core/Py.java 2010-11-09 22:55:15 UTC (rev 7170)
@@ -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);
}
Modified: trunk/jython/src/org/python/core/PyType.java
===================================================================
--- trunk/jython/src/org/python/core/PyType.java 2010-11-06 00:15:33 UTC (rev 7169)
+++ trunk/jython/src/org/python/core/PyType.java 2010-11-09 22:55:15 UTC (rev 7170)
@@ -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
Modified: trunk/jython/src/org/python/util/PyServlet.java
===================================================================
--- trunk/jython/src/org/python/util/PyServlet.java 2010-11-06 00:15:33 UTC (rev 7169)
+++ trunk/jython/src/org/python/util/PyServlet.java 2010-11-09 22:55:15 UTC (rev 7170)
@@ -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";
Modified: trunk/jython/src/org/python/util/PythonInterpreter.java
===================================================================
--- trunk/jython/src/org/python/util/PythonInterpreter.java 2010-11-06 00:15:33 UTC (rev 7169)
+++ trunk/jython/src/org/python/util/PythonInterpreter.java 2010-11-09 22:55:15 UTC (rev 7170)
@@ -94,7 +94,7 @@
protected PythonInterpreter(PyObject dict, PySystemState systemState, boolean useThreadLocalState) {
if (dict == null) {
- dict = new PyStringMap();
+ dict = Py.newStringMap();
}
globals = dict;
Modified: trunk/jython/src/org/python/util/jython.java
===================================================================
--- trunk/jython/src/org/python/util/jython.java 2010-11-06 00:15:33 UTC (rev 7169)
+++ trunk/jython/src/org/python/util/jython.java 2010-11-09 22:55:15 UTC (rev 7170)
@@ -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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|