From: SourceForge.net <no...@so...> - 2008-09-26 15:16:56
|
Bugs item #2130351, was opened at 2008-09-26 17:16 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=2130351&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: David Michel (dav_m) Assigned to: Nobody/Anonymous (nobody) Summary: immutable directive creates a 2nd variable ? Initial Comment: Normally, when using an interface file for python like this: //example.i %module example %{ int a; %} int a; the variable a is available in python via the command: example.cvar.a and has by default read and write access. When using the the %immutable directive such as: //example.i %module example %{ int a; %} %immutable int a; SWIG actually creates a example.cvar.a which is effectively read-only (that's what it's suppose to do) but also create a another, separate variable example.a which has read-write permissions (not good at all !): >>> import example >>> example.a 0.0 >>> example.cvar.a 0.0 >>> example.cvar.a = 3 Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: Variable a is read-only. >>> example.a = 3 >>> example.a 3 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2130351&group_id=1645 |