mirror of https://github.com/swig/swig
Merge branch 'Issue-1643'
* Issue-1643: Fix pydoc null pointer dereference with missing arg type
This commit is contained in:
commit
aa59c81205
|
@ -110,6 +110,20 @@ double Atan2(double y, double x)
|
|||
/* Regression test for crash with empty comment: */
|
||||
/**/
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*/
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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),
|
||||
"""\
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue