[Python] Fix docstrings for %callback functions

Reinstates autodoc for callback function testcase from #467, actually
tests the resulting docstring in the _runme.py and fixes SWIG/Python
so the expected result is obtained.
This commit is contained in:
Olly Betts 2015-09-04 13:04:37 +12:00
commit 8ab622c6d0
4 changed files with 11 additions and 1 deletions

View file

@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 3.0.8 (in progress)
===========================
2015-09-04: olly
[Python] Fix docstrings for %callback functions.
2015-08-07: talby
[Perl] tidy -Wtautological-constant-out-of-range-compare warnings when building generated code under clang

View file

@ -114,6 +114,12 @@
}
%}
%callback("%(uppercase)s_CALLBACK") func_cb;
%inline {
int func_cb(int c, int d) { return c; }
}
// Bug 3310528
%feature("autodoc","1") banana; // names + types
%inline %{

View file

@ -355,4 +355,5 @@ check(funkdefaults.__doc__,
check(func_input.__doc__, "func_input(int * INPUT) -> int")
check(func_output.__doc__, "func_output() -> int")
check(func_inout.__doc__, "func_inout(int * INOUT) -> int")
check(func_cb.__doc__, "func_cb(int c, int d) -> int")
check(banana.__doc__, "banana(S a, S b, int c, Integer d)")

View file

@ -2389,7 +2389,7 @@ public:
Printv(f_dest, tab4 "return ", funcCall(name, callParms), "\n", NIL);
}
if (Getattr(n, "feature:python:callback") || !have_addtofunc(n)) {
if ((Getattr(n, "feature:python:callback") && !have_docstring(n)) || !have_addtofunc(n)) {
/* If there is no addtofunc directive then just assign from the extension module (for speed up) */
Printv(f_dest, name, " = ", module, ".", name, "\n", NIL);
}