Bug 796137 - Fix QofIdType and QofIdTypeConst to work with python3

Patch by David Osguthorpe to provide typemaps so that SWIG doesn't
free buffers mem when buffer is saved as part of query struct leading
to garbage content. See https://bugs.gnucash.org/show_bug.cgi?id=796137
This commit is contained in:
Christoph Holtermann 2018-09-07 15:06:22 +02:00
parent 0551ee36e8
commit 6384854319

View File

@ -220,6 +220,28 @@ typedef char gchar;
}
}
%typemap(in) QofIdType {
if (PyUnicode_Check($input)) {
$1 = PyUnicode_AsUTF8($input);
} else if (PyBytes_Check($input)) {
$1 = PyBytes_AsString($input);
} else {
PyErr_SetString(PyExc_TypeError, "not a string or bytes object");
return NULL;
}
}
%typemap(in) QofIdTypeConst {
if (PyUnicode_Check($input)) {
$1 = PyUnicode_AsUTF8($input);
} else if (PyBytes_Check($input)) {
$1 = PyBytes_AsString($input);
} else {
PyErr_SetString(PyExc_TypeError, "not a string or bytes object");
return NULL;
}
}
%typemap(in) GSList *, QofQueryParamList * {
$1 = NULL;
/* Check if is a list */