diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2020-01-16 18:54:47 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2020-01-16 18:54:47 +0000 |
commit | aa59c81205adf43a04a5c233f89b7c74f2e09160 (patch) | |
tree | 151f87a4567ed106415477e313083f48c5c4afca | |
parent | 19e7648d25ad6bae54b004dd4d08c347259e7572 (diff) | |
parent | f99eb0058b590e29ed7b0264266fd2c2ca6c8faf (diff) | |
download | swig-aa59c81205adf43a04a5c233f89b7c74f2e09160.tar.gz |
Merge branch 'Issue-1643'
* Issue-1643:
Fix pydoc null pointer dereference with missing arg type
-rw-r--r-- | Examples/test-suite/doxygen_basic_translate.i | 14 | ||||
-rw-r--r-- | Examples/test-suite/java/doxygen_basic_translate_runme.java | 7 | ||||
-rw-r--r-- | Examples/test-suite/python/doxygen_basic_translate_runme.py | 10 | ||||
-rw-r--r-- | Source/Doxygen/pydoc.cxx | 9 |
4 files changed, 35 insertions, 5 deletions
diff --git a/Examples/test-suite/doxygen_basic_translate.i b/Examples/test-suite/doxygen_basic_translate.i index 232633f8d..4e543fef9 100644 --- a/Examples/test-suite/doxygen_basic_translate.i +++ b/Examples/test-suite/doxygen_basic_translate.i @@ -111,6 +111,20 @@ double Atan2(double y, double x) /**/ /** + * @brief Test variadic function + * @param ... extra args + */ +void function8(...) { +} + +/** + * @brief Test unnamed argument + * @param baz Description of baz + */ +void function9(int) { +} + +/** * Comment at the end of file should be ignored. */ %} diff --git a/Examples/test-suite/java/doxygen_basic_translate_runme.java b/Examples/test-suite/java/doxygen_basic_translate_runme.java index f0b1efb6b..c64262a67 100644 --- a/Examples/test-suite/java/doxygen_basic_translate_runme.java +++ b/Examples/test-suite/java/doxygen_basic_translate_runme.java @@ -86,6 +86,13 @@ public class doxygen_basic_translate_runme { " @param x Horizontal coordinate.\n" + " @return Arc tangent of <code>y/x</code>.\n" + ""); + wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function8()", + " Test variadic function\n" + + ""); + + wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function9(int)", + " Test unnamed argument\n" + + ""); // and ask the parser to check comments for us System.exit(CommentParser.check(wantedComments)); diff --git a/Examples/test-suite/python/doxygen_basic_translate_runme.py b/Examples/test-suite/python/doxygen_basic_translate_runme.py index 90edda132..4cd500178 100644 --- a/Examples/test-suite/python/doxygen_basic_translate_runme.py +++ b/Examples/test-suite/python/doxygen_basic_translate_runme.py @@ -70,6 +70,16 @@ Test for a parameter with difficult type :type a: :py:class:`Shape` :param a: Very strange param""" ) +comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function8), + """\ +Test variadic function +:param ...: extra args""" +) +comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function9), + """\ +Test unnamed argument +:param baz: Description of baz""" +) comment_verifier.check(inspect.getdoc(doxygen_basic_translate.Atan2), """\ diff --git a/Source/Doxygen/pydoc.cxx b/Source/Doxygen/pydoc.cxx index f2031f481..9f00d5548 100644 --- a/Source/Doxygen/pydoc.cxx +++ b/Source/Doxygen/pydoc.cxx @@ -434,11 +434,10 @@ std::string PyDocConverter::getParamType(std::string param) { ParmList *plist = CopyParmList(Getattr(currentNode, "parms")); for (Parm *p = plist; p; p = nextSibling(p)) { String *pname = Getattr(p, "name"); - if (Char(pname) != param) - continue; - - type = getPyDocType(p, pname); - break; + if (pname && Char(pname) == param) { + type = getPyDocType(p, pname); + break; + } } Delete(plist); return type; |