diff --git a/CHANGES.current b/CHANGES.current index 8c269f295..33b59fafa 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -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 diff --git a/Examples/test-suite/autodoc.i b/Examples/test-suite/autodoc.i index eda04d293..a2d9f5b4e 100644 --- a/Examples/test-suite/autodoc.i +++ b/Examples/test-suite/autodoc.i @@ -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 %{ diff --git a/Examples/test-suite/python/autodoc_runme.py b/Examples/test-suite/python/autodoc_runme.py index 7256669d9..ce0aae0eb 100644 --- a/Examples/test-suite/python/autodoc_runme.py +++ b/Examples/test-suite/python/autodoc_runme.py @@ -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)") diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index d894ba53c..35cfa63e9 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -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); }