diff --git a/Examples/test-suite/director_keywords.i b/Examples/test-suite/director_keywords.i index 53f124772..53f36a8f6 100644 --- a/Examples/test-suite/director_keywords.i +++ b/Examples/test-suite/director_keywords.i @@ -11,5 +11,6 @@ struct Foo { virtual ~Foo() {} virtual void check_abstract(int abstract) {} // for Java, C#, D... virtual void check_self(int self) {} // self for Python + virtual void check_from(int from) {} // for Python }; %} diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index e2c3180ff..6a0b286ca 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -4841,6 +4841,16 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) { int idx; bool ignored_method = GetFlag(n, "feature:ignore") ? true : false; + if (builtin) { + // Rename any wrapped parameters called 'self' as the generated code contains a variable with same name + Parm *p; + for (p = l; p; p = nextSibling(p)) { + String *arg = Getattr(p, "name"); + if (arg && Cmp(arg, "self") == 0) + Delattr(p, "name"); + } + } + if (Cmp(storage, "virtual") == 0) { if (Cmp(value, "0") == 0) { pure_virtual = true;