Update of /cvsroot/jython/jython/org/python/core
In directory slayer.i.sourceforge.net:/tmp/cvs-serv15269
Modified Files:
imp.java
Log Message:
Support initialization of java classes which implement the ModuleDictInit
initerface.
Index: imp.java
===================================================================
RCS file: /cvsroot/jython/jython/org/python/core/imp.java,v
retrieving revision 2.28
retrieving revision 2.29
diff -C2 -r2.28 -r2.29
*** imp.java 2000/11/17 21:12:40 2.28
--- imp.java 2000/11/17 21:14:24 2.29
***************
*** 2,5 ****
--- 2,6 ----
package org.python.core;
+ import java.lang.reflect.*;
import java.io.*;
import java.util.Hashtable;
***************
*** 184,188 ****
}
}
! return PyJavaClass.lookup(c);
}
--- 185,205 ----
}
}
! PyJavaClass ret = PyJavaClass.lookup(c);
! initModule(c, ret.__getattr__("__dict__"));
! return ret;
! }
!
! public static void initModule(Class c, PyObject dict) {
! if (ModuleDictInit.class.isAssignableFrom(c)
! && c != ModuleDictInit.class) {
! try {
! Method m = c.getMethod("moduleDictInit",
! new Class[] { PyObject.class });
! m.invoke(null, new Object[] { dict });
! } catch (Exception exc) {
! // System.err.println("Got exception: " + exc + " " + proxyClass);
! throw Py.JavaError(exc);
! }
! }
}
|