From: SourceForge.net <no...@so...> - 2008-06-01 14:05:43
|
Bugs item #1981315, was opened at 2008-06-01 15:51 Message generated for change (Comment added) made by paulmelis You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1981315&group_id=1645 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: python Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Paul E.C. Melis (paulmelis) Assigned to: Nobody/Anonymous (nobody) Summary: Infinite recursion with cross-module inheritance Initial Comment: Given: - two modules, mod1 and mod2, meant for wrapping in Python - mod1 contains a C++ class Base - mod2 contains a class Derived, which is derived from Base - directors enabled for both classes - directors enabled for both modules - the following C++ code: class Base { public: virtual void do_something() { printf("Base::do_something()\n"); } virtual ~Base() {} }; class Derived: public Base { public: virtual ~Derived() {} }; - the rest of the details in the attached tgz The following test script results in an infinite recursion: import sys import mod1 import mod2 def traceit(frame, event, arg): if event == "line": lineno = frame.f_lineno filename = frame.f_globals["__file__"] print "%s, line %d" % (filename, lineno) return traceit sys.settrace(traceit) class MyBase(mod1.Base): def __init__(self): mod1.Base.__init__(self) b = MyBase() b.do_something() # Succeeds class MyDerived(mod2.Derived): def __init__(self): mod2.Derived.__init__(self) d = MyDerived() d.do_something() # Fails I've added the trace function, as the exception raised does not give the information on the infinite recursion. The line in question constantly being executed is mod1.py:64, which is class Base(_object): ... def do_something(*args): return _mod1.Base_do_something(*args) # <----- .... It seems the call can't "cross over" into mod2, or something like that. ---------------------------------------------------------------------- >Comment By: Paul E.C. Melis (paulmelis) Date: 2008-06-01 16:05 Message: Logged In: YES user_id=548640 Originator: YES This is with both 1.3.29 and 1.3.35, btw ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1981315&group_id=1645 |