|
From: <bc...@wo...> - 2001-05-07 19:26:47
|
[Rich Seddon] >I've been playing with the latest jython from CVS, and I'm having some >trouble getting my code to work with it. When I attempt to call a Java method >that is overridden in a python class, but not overridden in all intermediate >python classes, I get a stack overflow. > >The following test program fails using the latest CVS, but works fine if I >pull jython using the "Release_2_1alpha1" tag: > >from javax.swing import * > >class fooFrame(JFrame): > def __init__(self): > JFrame.__init__(self) > >class barFrame(fooFrame): > def __init__(self): > fooFrame.__init__(self) > > def setSize(self, width, height): > fooFrame.setSize(self, width, height) > > >if __name__ == "__main__": > frm = barFrame() > frm.setSize(100,100) > > frm.show() > Thanks for the test program. The bug was introduced as a side effect of solving the old SubSubDate problem. http://sourceforge.net/tracker/?group_id=12867&atid=112867&aid=222819&func=detail Clearly the cure is worse than the disease so I have reverted the change. Deeper thinking is still needed on this problem. Just considering the situation where the call of a super method skip one level. Using the current "super__" naming scheme will never be enough to handle the JFrame.setSize() call in barFrame.setSize(): from javax.swing import * class fooFrame(JFrame): def __init__(self): JFrame.__init__(self) def setSize(self, width, height): JFrame.setSize(self, width, height) class barFrame(fooFrame): def __init__(self): fooFrame.__init__(self) def setSize(self, width, height): JFrame.setSize(self, width, height) if __name__ == "__main__" and 1: frm = barFrame() frm.setSize(100,100) frm.show() regards, finn |