Fix Python -classic and property setting
Setting properties on classic classes was broken in swig-3.0.3 by attempting to use __setattr__. This regression is fixed now by using __dict__ again when using -classic. Fixes patch #232.
This commit is contained in:
parent
727d74f6be
commit
39a75442a1
2 changed files with 17 additions and 1 deletions
|
|
@ -5,6 +5,12 @@ See the RELEASENOTES file for a summary of changes in each release.
|
||||||
Version 3.0.5 (in progress)
|
Version 3.0.5 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2015-01-30: wsfulton
|
||||||
|
[Python] Fix Python -classic and property setting. Setting properties on classic classes
|
||||||
|
was broken in swig-3.0.3 by attempting to use __setattr__. This regression is fixed now
|
||||||
|
by using __dict__ again when using -classic.
|
||||||
|
Fixes patch #232.
|
||||||
|
|
||||||
2015-01-27: smarchetto
|
2015-01-27: smarchetto
|
||||||
Support for the Scilab language has been added
|
Support for the Scilab language has been added
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -873,7 +873,17 @@ public:
|
||||||
#else
|
#else
|
||||||
tab4, "if (not static):\n",
|
tab4, "if (not static):\n",
|
||||||
#endif
|
#endif
|
||||||
tab4, tab4, "object.__setattr__(self, name, value)\n",
|
NIL);
|
||||||
|
if (!classic) {
|
||||||
|
if (!modern)
|
||||||
|
Printv(f_shadow, tab4, tab4, "if _newclass:\n", tab4, NIL);
|
||||||
|
Printv(f_shadow, tab4, tab4, "object.__setattr__(self, name, value)\n", NIL);
|
||||||
|
if (!modern)
|
||||||
|
Printv(f_shadow, tab4, tab4, "else:\n", tab4, NIL);
|
||||||
|
}
|
||||||
|
if (classic || !modern)
|
||||||
|
Printv(f_shadow, tab4, tab4, "self.__dict__[name] = value\n", NIL);
|
||||||
|
Printv(f_shadow,
|
||||||
tab4, "else:\n",
|
tab4, "else:\n",
|
||||||
tab4, tab4, "raise AttributeError(\"You cannot add attributes to %s\" % self)\n\n",
|
tab4, tab4, "raise AttributeError(\"You cannot add attributes to %s\" % self)\n\n",
|
||||||
"\n", "def _swig_setattr(self, class_type, name, value):\n", tab4, "return _swig_setattr_nondynamic(self, class_type, name, value, 0)\n\n", NIL);
|
"\n", "def _swig_setattr(self, class_type, name, value):\n", tab4, "return _swig_setattr_nondynamic(self, class_type, name, value, 0)\n\n", NIL);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue