Update of /cvsroot/jython/jython/org/python/compiler
In directory usw-pr-cvs1:/tmp/cvs-serv29124
Modified Files:
ProxyMaker.java
Log Message:
interpreter fix for #222819.
Index: ProxyMaker.java
===================================================================
RCS file: /cvsroot/jython/jython/org/python/compiler/ProxyMaker.java,v
retrieving revision 2.12
retrieving revision 2.13
diff -C2 -r2.12 -r2.13
*** ProxyMaker.java 2001/03/22 20:04:22 2.12
--- ProxyMaker.java 2001/06/30 01:01:28 2.13
***************
*** 655,665 ****
public void addSuperMethod(String methodName, String superName,
! String superclass, Class[] parameters,
Class ret, String sig, int access)
throws Exception
{
supernames.put(methodName, methodName);
Code code = classfile.addMethod(methodName, sig, access);
! callSuper(code, superName, superclass, parameters, ret, sig);
}
--- 655,680 ----
public void addSuperMethod(String methodName, String superName,
! String declClass, Class[] parameters,
Class ret, String sig, int access)
throws Exception
{
+ if (methodName.startsWith("super__")) {
+ /* rationale: JC java-class, P proxy-class subclassing JC
+ in order to avoid infinite recursion P should define super__foo
+ only if no class between P and JC in the hierarchy defines it yet;
+ this means that the python class needing P is the first that
+ redefines the JC method foo.
+ */
+ try {
+ superclass.getMethod(methodName,parameters);
+ return;
+ } catch(NoSuchMethodException e) {
+ } catch(SecurityException e) {
+ return;
+ }
+ }
supernames.put(methodName, methodName);
Code code = classfile.addMethod(methodName, sig, access);
! callSuper(code, superName, declClass, parameters, ret, sig);
}
|