fix regression of Python constructor renaming introduced by py3k work

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11997 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Haoyu Bai 2010-04-25 14:07:14 +00:00
parent ff8f6b5c66
commit 2450c4b108
5 changed files with 22 additions and 2 deletions

View File

@ -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.

View File

@ -131,6 +131,7 @@ CPP_TEST_CASES += \
constructor_exception \
constructor_explicit \
constructor_ignore \
constructor_rename \
constructor_value \
contract \
conversion \

View File

@ -0,0 +1,12 @@
%module constructor_rename
%{
struct Foo {
Foo() {}
};
%}
struct Foo {
%rename(RenamedConstructor) Foo();
Foo() {}
};

View File

@ -0,0 +1,3 @@
from constructor_rename import *
x = RenamedConstructor()

View File

@ -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))