Update of /cvsroot/jython/jython/org/python/compiler
In directory usw-pr-cvs1:/tmp/cvs-serv22052
Modified Files:
ProxyMaker.java
Log Message:
Fix for #231507 and #406193. The classDictInit will assign a list of
names which describe the special super__ methods.
Index: ProxyMaker.java
===================================================================
RCS file: /cvsroot/jython/jython/org/python/compiler/ProxyMaker.java,v
retrieving revision 2.11
retrieving revision 2.12
diff -C2 -r2.11 -r2.12
*** ProxyMaker.java 2000/12/15 03:19:00 2.11
--- ProxyMaker.java 2001/03/22 20:04:22 2.12
***************
*** 50,53 ****
--- 50,54 ----
Class[] interfaces;
Hashtable names;
+ Hashtable supernames = new Hashtable();
public ClassFile classfile;
public String myClass;
***************
*** 658,663 ****
throws Exception
{
! Code code = classfile.addMethod(methodName, sig, access);
! callSuper(code, superName, superclass, parameters, ret, sig);
}
--- 659,665 ----
throws Exception
{
! supernames.put(methodName, methodName);
! Code code = classfile.addMethod(methodName, sig, access);
! callSuper(code, superName, superclass, parameters, ret, sig);
}
***************
*** 709,713 ****
code.aload(0);
code.getfield(field);
! code.areturn();
}
--- 711,744 ----
code.aload(0);
code.getfield(field);
! code.areturn();
! }
!
! public void addClassDictInit() throws Exception {
! int n = supernames.size();
!
! // classDictInit method
! classfile.addInterface(mapClass(org.python.core.ClassDictInit.class));
! Code code = classfile.addMethod("classDictInit",
! "(Lorg/python/core/PyObject;)V",
! Modifier.PUBLIC | Modifier.STATIC);
! code.aload(0);
! code.ldc("__supernames__");
!
! String[] names = new String[n];
! Enumeration e = supernames.keys();
! for (int i = 0; e.hasMoreElements(); )
! names[i++] = (String) e.nextElement();
! CodeCompiler.makeStrings(code, names, n);
! int j2py = code.pool.Methodref(
! "org/python/core/Py", "java2py",
! "(Ljava/lang/Object;)Lorg/python/core/PyObject;");
! code.invokestatic(j2py);
!
! int setitem = code.pool.Methodref(
! "org/python/core/PyObject", "__setitem__",
! "(Ljava/lang/String;Lorg/python/core/PyObject;)V");
! code.invokevirtual(setitem);
! code.return_();
!
}
***************
*** 738,741 ****
--- 769,773 ----
addMethods(superclass, seenmethods);
doConstants();
+ addClassDictInit();
}
|