From: Finn B. <bc...@us...> - 2001-02-14 22:17:15
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv11453 Modified Files: MakeProxies.java PyClass.java Log Message: Fix a so far undetected bug where .newInstance() on the proxy class failes to find the python module and python class. The bug was introduced when I renamed the proxyname class name to include the both <module>$<class>. Index: MakeProxies.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/MakeProxies.java,v retrieving revision 2.15 retrieving revision 2.16 diff -C2 -r2.15 -r2.16 *** MakeProxies.java 2001/02/02 09:28:36 2.15 --- MakeProxies.java 2001/02/14 22:17:54 2.16 *************** *** 55,59 **** public static synchronized Class makeProxy(Class superclass, Vector vinterfaces, ! String name, PyObject dict) { --- 55,60 ---- public static synchronized Class makeProxy(Class superclass, Vector vinterfaces, ! String className, ! String proxyName, PyObject dict) { *************** *** 63,67 **** interfaces[i] = (Class)vinterfaces.elementAt(i); } ! String proxyName = proxyPrefix + name + "$" + proxyNumber++; String pythonModuleName; PyObject mn=dict.__finditem__("__module__"); --- 64,68 ---- interfaces[i] = (Class)vinterfaces.elementAt(i); } ! String fullProxyName = proxyPrefix + proxyName + "$" + proxyNumber++; String pythonModuleName; PyObject mn=dict.__finditem__("__module__"); *************** *** 70,81 **** else pythonModuleName = (String)mn.__tojava__(String.class); ! ! JavaMaker jm = new JavaMaker(superclass, interfaces, name, ! pythonModuleName, proxyName, dict); try { jm.build(); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); jm.classfile.write(bytes); ! Py.saveClassFile(proxyName, bytes); return makeClass(superclass, vinterfaces, jm.myClass, bytes); --- 71,81 ---- else pythonModuleName = (String)mn.__tojava__(String.class); ! JavaMaker jm = new JavaMaker(superclass, interfaces, className, ! pythonModuleName, fullProxyName, dict); try { jm.build(); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); jm.classfile.write(bytes); ! Py.saveClassFile(fullProxyName, bytes); return makeClass(superclass, vinterfaces, jm.myClass, bytes); Index: PyClass.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyClass.java,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -r2.19 -r2.20 *** PyClass.java 2001/02/07 09:23:52 2.19 --- PyClass.java 2001/02/14 22:17:54 2.20 *************** *** 91,95 **** proxyName = module.toString() + "$" + __name__; proxyClass = MakeProxies.makeProxy(baseClass, interfaces, ! proxyName, __dict__); } } --- 91,96 ---- proxyName = module.toString() + "$" + __name__; proxyClass = MakeProxies.makeProxy(baseClass, interfaces, ! __name__, proxyName, ! __dict__); } } |