diff --git a/SWIG/Source/Modules/python.cxx b/SWIG/Source/Modules/python.cxx index 37a183322..93159f0a4 100644 --- a/SWIG/Source/Modules/python.cxx +++ b/SWIG/Source/Modules/python.cxx @@ -2610,7 +2610,6 @@ public: if (str != NULL && Len(str)) Printv(f_shadow, tab4, str, "\n", NIL); } - if (!modern) { Printv(f_shadow, tab4, "__swig_setmethods__ = {}\n", NIL); if (Len(base_class)) { Printf(f_shadow, "%sfor _s in [%s]: __swig_setmethods__.update(_s.__swig_setmethods__)\n", tab4, base_class); @@ -2628,7 +2627,7 @@ public: } Printv(f_shadow, tab4, "__getattr__ = lambda self, name: _swig_getattr(self, ", class_name, ", name)\n", NIL); - } else { + if (modern) { Printv(f_shadow, tab4, "thisown = _swig_property(lambda x: x.this.own(), ", "lambda x, v: x.this.own(v), doc='The membership flag')\n", NIL); /* Add static attribute */ if (GetFlag(n, "feature:python:nondynamic")) {