[Python] Fix lack of generation of docstrings when -O is used.
Also, fix generation of docstrings containing a double quote character. Patch from Richard Boulton in bug#1700146. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9684 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
2d962ac1f2
commit
898e5f7f3d
8 changed files with 66 additions and 2 deletions
|
|
@ -1419,19 +1419,26 @@ public:
|
|||
Printf(methods, "\t { (char *)\"%s\", (PyCFunction) %s, METH_VARARGS | METH_KEYWORDS, ", name, function);
|
||||
}
|
||||
|
||||
if (n && Getattr(n, "feature:callback")) {
|
||||
if (!n) {
|
||||
Append(methods, "NULL");
|
||||
} else if (Getattr(n, "feature:callback")) {
|
||||
if (have_docstring(n)) {
|
||||
String *ds = docstring(n, AUTODOC_FUNC, "", false);
|
||||
Replaceall(ds, "\n", "\\n");
|
||||
Replaceall(ds, "\"", "\\\"");
|
||||
Printf(methods, "(char *)\"%s\\nswig_ptr: %s\"", ds, Getattr(n, "feature:callback:name"));
|
||||
} else {
|
||||
Printf(methods, "(char *)\"swig_ptr: %s\"", Getattr(n, "feature:callback:name"));
|
||||
}
|
||||
} else if (have_docstring(n)) {
|
||||
String *ds = docstring(n, AUTODOC_FUNC, "", false);
|
||||
Replaceall(ds, "\n", "\\n");
|
||||
Replaceall(ds, "\"", "\\\"");
|
||||
Printf(methods, "(char *)\"%s\"", ds);
|
||||
} else {
|
||||
Append(methods, "NULL");
|
||||
}
|
||||
|
||||
|
||||
Append(methods, "},\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue