From: SourceForge.net <no...@so...> - 2008-01-22 16:38:58
|
Bugs item #1877490, was opened at 2008-01-22 17:38 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1877490&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: Lars Immisch (larsimmisch) Assigned to: Nobody/Anonymous (nobody) Summary: option -O conflicts with %pythonnondynamic and %extend Initial Comment: The option -O conflicts with %pythonnondynamic and %extend. The interface below uses %feature(python:nondynamic) and %extend. When it is compiled with -O, the resulting shadow module cannot be loaded. If -O is omitted whenn swigging, the resulting module can be imported. Also, this bug was not present in swig 1.3.28. %module nondynamic %{ typedef struct { int bar; int baz; } FOO; %} %feature("python:nondynamic"); typedef struct { int bar; int baz; } FOO; %extend FOO { void clear(void) { self->bar = 0; self->baz = 0; } }; When this interface is compiled with: swig -python -O an attempt to load the module will fail: >>> import nondynamic Traceback (most recent call last): File "<stdin>", line 1, in <module> File "nondynamic.py", line 65, in <module> FOO.clear = new_instancemethod(_nondynamic.FOO_clear,None,FOO) File "nondynamic.py", line 50, in set_attr raise AttributeError("You cannot add attributes to %s" % self) AttributeError: You cannot add attributes to <class 'nondynamic.FOO'> ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1877490&group_id=1645 |