From: <no...@so...> - 2001-07-18 16:12:19
|
Bugs item #406193, was opened at 2001-03-05 20:16 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=112867&aid=406193&group_id=12867 Category: Core >Group: Fixed in 2.1a2 Status: Closed Resolution: Fixed Priority: 5 Submitted By: brian zimmer (bzimmer) Assigned to: Finn Bock (bckfnn) Summary: stack overflow when delegating Initial Comment: There appears to be a problem with PyReflectedFunction when a Python class is an implementation of a Java interface and delegates to a Java implementation of that interface. The primary problem is overloaded methods on the interface, such as the ISimple.get() methods. Look at classes t and u. Both do as expected. t is not the interface, so it's marginally useful. u implements the interface but needs to handle the get() methods in order for it to work properly. v is what I want, but it ends up blowing the stack. Should this work? I think yes, but can't figure out how to patch it. Run the code to get the full affect: import Simple, ISimple class t: def __init__(self, s): self.s = s def __getattr__(self, name): return getattr(self.s, name) class u(ISimple): def __init__(self, s): self.s = s def get(self, i=None): if i: return self.s.get(i) else: return self.s.get() class v(ISimple): def __init__(self, s): self.s = s def __getattr__(self, name): return getattr(self.s, name) def main(): print "using Simple" y = Simple() print y print y.get() print y.get(2) print y.get() print y.get(0) print "using t" y = t(Simple()) print y print y.get() print y.get(2) print y.get() print y.get(0) print "using u" y = u(Simple()) print y print y.get() print y.get(2) print y.get() print y.get(0) print "using v" y = v(Simple()) print y print y.get() print y.get(2) print y.get() print y.get(0) if __name__ == '__main__': main() ---------------------------------------------------------------------- Comment By: Finn Bock (bckfnn) Date: 2001-03-22 12:52 Message: Logged In: YES user_id=4201 Fixed in: PyClass.java: 2.23; ProxyMaker.java: 2.12; JavaMaker.java: 2.10; ObjectFactory.py: 2.7; compile.py: 2.17; proxies.py: 2.10; ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2001-03-06 10:38 Message: Logged In: NO Please look at the attached jar for all the source. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=112867&aid=406193&group_id=12867 |