Fix handling of default arguments after ignored ones in Python.
Don't skip checking subsequent arguments just because one of them has "in" typemap with numinputs=0 attribute. Add a unit test showing the problem which is relatively rare as it doesn't happen for the class methods and is hidden unless autodoc feature is used for the global functions. Closes #377.
This commit is contained in:
parent
d64c241e1c
commit
6988b00aba
4 changed files with 28 additions and 5 deletions
|
|
@ -278,3 +278,17 @@ struct ConstMethods {
|
|||
} Pointf;
|
||||
}
|
||||
%}
|
||||
|
||||
// Default arguments after ignored ones.
|
||||
%typemap(in, numinputs=0) int square_error { $1 = 2; };
|
||||
%typemap(default, noblock=1) int def17 { $1 = 17; };
|
||||
|
||||
// Enabling autodoc feature has a side effect of disabling the generation of
|
||||
// aliases for functions that can hide problems with default arguments at
|
||||
// Python level.
|
||||
%feature("autodoc","0") slightly_off_square;
|
||||
|
||||
%inline %{
|
||||
inline int slightly_off_square(int square_error, int def17) { return def17*def17 + square_error; }
|
||||
%}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue