diff --git a/CHANGES.current b/CHANGES.current index 387ad224b..0a707a918 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,6 +1,9 @@ Version 2.0.0 (in progress) ============================ +2010-04-25: bhy + [Python] Fix #2985655 - broken constructor renaming. + 2010-04-14: wsfulton Typemap fragments are now official and documented in Typemaps.html. diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index a902166b5..308ff9f1e 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -131,6 +131,7 @@ CPP_TEST_CASES += \ constructor_exception \ constructor_explicit \ constructor_ignore \ + constructor_rename \ constructor_value \ contract \ conversion \ diff --git a/Examples/test-suite/constructor_rename.i b/Examples/test-suite/constructor_rename.i new file mode 100644 index 000000000..401b07d65 --- /dev/null +++ b/Examples/test-suite/constructor_rename.i @@ -0,0 +1,12 @@ +%module constructor_rename + +%{ +struct Foo { + Foo() {} +}; +%} + +struct Foo { + %rename(RenamedConstructor) Foo(); + Foo() {} +}; diff --git a/Examples/test-suite/python/constructor_rename_runme.py b/Examples/test-suite/python/constructor_rename_runme.py new file mode 100644 index 000000000..cf3f88b81 --- /dev/null +++ b/Examples/test-suite/python/constructor_rename_runme.py @@ -0,0 +1,3 @@ +from constructor_rename import * + +x = RenamedConstructor() diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 3639efe86..93679084c 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -3257,6 +3257,7 @@ public: String *classname = Swig_class_name(parent); String *rclassname = Swig_class_name(getCurrentClass()); assert(rclassname); + String *parms = make_pyParmList(n, true, false, allow_kwargs); /* Pass 'self' only if using director */ @@ -3300,8 +3301,8 @@ public: Printv(f_shadow_stubs, pycode, "\n", NIL); Delete(pycode); } else { - String *parms = make_pyParmList(n, true, false, allow_kwargs); - String *callParms = make_pyParmList(n, true, true, allow_kwargs); + String *parms = make_pyParmList(n, false, false, allow_kwargs); + String *callParms = make_pyParmList(n, false, true, allow_kwargs); Printv(f_shadow_stubs, "\ndef ", symname, "(", parms, ")", returnTypeAnnotation(n), ":\n", NIL); if (have_docstring(n))