mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
parent
0551ee36e8
commit
6384854319
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user