gnucash stable: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Thu Jun 25 20:47:51 EDT 2026
Updated via https://github.com/Gnucash/gnucash/commit/cb6b1408 (commit)
via https://github.com/Gnucash/gnucash/commit/5dea8dfe (commit)
via https://github.com/Gnucash/gnucash/commit/115ef7f6 (commit)
via https://github.com/Gnucash/gnucash/commit/b616838c (commit)
via https://github.com/Gnucash/gnucash/commit/68eaeaae (commit)
via https://github.com/Gnucash/gnucash/commit/e1f03913 (commit)
via https://github.com/Gnucash/gnucash/commit/4c52ba3a (commit)
from https://github.com/Gnucash/gnucash/commit/dc03a84c (commit)
commit cb6b1408056eea1eae8d88777e3cf84b7b7e0936
Merge: dc03a84c33 5dea8dfe5c
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Jun 25 17:37:29 2026 -0700
Merge Oliver Lok Trevor's 'fix-glist-python-bindings' into stable
commit 5dea8dfe5cda8a217dd2c1ac2bea424098257903
Author: Oliver Lok Trevor <featherfeet5436 at gmail.com>
Date: Tue Apr 28 17:45:46 2026 -0400
Removed unnecessary list reversal as per code review. Removed stray include.
diff --git a/bindings/python/gnucash_core.i b/bindings/python/gnucash_core.i
index 9303a4dc08..b328293f19 100644
--- a/bindings/python/gnucash_core.i
+++ b/bindings/python/gnucash_core.i
@@ -284,9 +284,6 @@ GNC_ACCEPT_WRAPPER(GncEntry)
g_list_free($1);
return NULL;
}
-
- // Reverse list to preserve original order.
- $1 = g_list_reverse($1);
}
}
else {
diff --git a/gnucash/gnome/dialog-sx-since-last-run.c b/gnucash/gnome/dialog-sx-since-last-run.c
index d14f18e854..433c1184fa 100644
--- a/gnucash/gnome/dialog-sx-since-last-run.c
+++ b/gnucash/gnome/dialog-sx-since-last-run.c
@@ -35,7 +35,6 @@
#include <config.h>
#include <glib.h>
#include <gtk/gtk.h>
-#include <stdint.h>
#include "dialog-utils.h"
#include "gnc-sx-instance-model.h"
commit 115ef7f657c90bde09d0d3293dc1869ce5507822
Author: Oliver Lok Trevor <featherfeet5436 at gmail.com>
Date: Wed Apr 30 15:51:10 2025 -0400
Added unit test.
diff --git a/bindings/python/tests/test_business.py b/bindings/python/tests/test_business.py
index 9f176756ce..f592362663 100644
--- a/bindings/python/tests/test_business.py
+++ b/bindings/python/tests/test_business.py
@@ -83,5 +83,16 @@ class TestBusiness(BusinessSession):
invoice_from_transaction = posted_transaction.GetInvoiceFromTxn()
self.assertTrue( invoice_from_transaction != None and invoice_from_transaction.GetID() == self.invoice.GetID() )
+ def test_invoice_payment(self):
+ """
+ Test that you can pay an invoice into a transfer account (this also tests conversion of Python lists to GList).
+ """
+ self.receivable.RecomputeBalance()
+ self.assertTrue( int(self.receivable.GetBalance().to_double()) == 100 )
+ lots = [self.invoice.GetPostedLot()]
+ self.customer.ApplyPayment(None, lots, self.receivable, self.bank, GncNumeric(100), GncNumeric(1), self.invoice.GetDatePosted(), "Paid into bank account.", "1234", False)
+ self.receivable.RecomputeBalance()
+ self.assertTrue( self.receivable.GetBalance().to_fraction().numerator == 0 )
+
if __name__ == '__main__':
main()
commit b616838ce3deae8fecb541b3467f29a28efc5605
Author: Oliver Lok Trevor <featherfeet5436 at gmail.com>
Date: Sat Mar 29 19:55:16 2025 -0400
Made GList converter get type from SWIG itself to avoid long string of type-checks.
diff --git a/bindings/python/gnucash_core.i b/bindings/python/gnucash_core.i
index a15cc214ff..9303a4dc08 100644
--- a/bindings/python/gnucash_core.i
+++ b/bindings/python/gnucash_core.i
@@ -262,7 +262,7 @@ GNC_ACCEPT_WRAPPER(GncEntry)
}
/* SWIG type converter for functions that take lists as arguments so that a Python list can be passed and automatically converted into a GList*. */
-%typemap(in) GList *, CommodityList *, SplitList *, AccountList *, LotList *, MonetaryList *, PriceList *, EntryList * {
+%typemap(in) GList * {
$1 = NULL;
/* Check if is a list */
if (PyList_Check($input)) {
@@ -273,60 +273,23 @@ GNC_ACCEPT_WRAPPER(GncEntry)
PyObject *python_object_wrapper = PyList_GetItem($input, i);
// Get the .instance attribute of the Python object, which is the raw SWIG handle.
PyObject *python_object = PyObject_GetAttrString(python_object_wrapper, "instance");
+ // Get the pointer to the actual C object.
+ SwigPyObject *swig_object = SWIG_Python_GetSwigThis(python_object);
void *c_object;
- // Attempt to convert the SWIG handle into a Gnucash C/C++ object and add it to the GList.
- if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncCustomer *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GncCustomer *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(Account *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (Account *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GNCLot *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GNCLot *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(Split *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (Split *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(Transaction *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (Transaction *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(gnc_commodity *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (gnc_commodity *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(gnc_monetary *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (gnc_monetary *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(gnc_commodity_namespace *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (gnc_commodity_namespace *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GNCPrice *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GNCPrice *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncInvoice *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GncInvoice *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncEntry *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GncEntry *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncVendor *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GncVendor *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncEmployee *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GncEmployee *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncJob *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GncJob *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncTaxTable *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GncTaxTable *) c_object);
+ if (SWIG_ConvertPtr(python_object, &c_object, swig_object->ty, SWIG_POINTER_EXCEPTION) == 0) { // Convert to whatever type Python says it is. Unfortunately do not have a way to figure out what type we should be converting to, since many Gnucash C functions take a generic GList.
+ $1 = g_list_prepend($1, c_object);
}
else {
- PyErr_SetString(PyExc_TypeError, "list must contain object of known type with .instance attribute, see base-typemaps.i in SWIG bindings.");
+ PyErr_SetString(PyExc_TypeError, "list must contain object of known type with .instance attribute, see gnucash_core.i in SWIG Python bindings.");
g_list_free($1);
return NULL;
}
+
+ // Reverse list to preserve original order.
+ $1 = g_list_reverse($1);
}
- } else {
+ }
+ else {
PyErr_SetString(PyExc_TypeError, "not a Python list, cannot convert to GList");
return NULL;
}
commit 68eaeaae8b966491615896e60503b0a8b59534c4
Author: Oliver Lok Trevor <featherfeet5436 at gmail.com>
Date: Tue Mar 18 19:54:32 2025 -0400
Moved list type conversions for Python to Python-specific binding definition files.
diff --git a/bindings/python/gnucash_core.i b/bindings/python/gnucash_core.i
index 0eb5af076f..a15cc214ff 100644
--- a/bindings/python/gnucash_core.i
+++ b/bindings/python/gnucash_core.i
@@ -261,6 +261,77 @@ GNC_ACCEPT_WRAPPER(GncEntry)
}
}
+/* SWIG type converter for functions that take lists as arguments so that a Python list can be passed and automatically converted into a GList*. */
+%typemap(in) GList *, CommodityList *, SplitList *, AccountList *, LotList *, MonetaryList *, PriceList *, EntryList * {
+ $1 = NULL;
+ /* Check if is a list */
+ if (PyList_Check($input)) {
+ int i;
+ int size = PyList_Size($input);
+ for (i = size - 1; i >= 0; i--) {
+ // Get the high-level Python object from bindings/python/gnucash_core.py.
+ PyObject *python_object_wrapper = PyList_GetItem($input, i);
+ // Get the .instance attribute of the Python object, which is the raw SWIG handle.
+ PyObject *python_object = PyObject_GetAttrString(python_object_wrapper, "instance");
+ void *c_object;
+ // Attempt to convert the SWIG handle into a Gnucash C/C++ object and add it to the GList.
+ if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncCustomer *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GncCustomer *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(Account *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (Account *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GNCLot *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GNCLot *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(Split *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (Split *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(Transaction *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (Transaction *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(gnc_commodity *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (gnc_commodity *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(gnc_monetary *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (gnc_monetary *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(gnc_commodity_namespace *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (gnc_commodity_namespace *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GNCPrice *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GNCPrice *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncInvoice *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GncInvoice *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncEntry *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GncEntry *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncVendor *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GncVendor *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncEmployee *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GncEmployee *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncJob *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GncJob *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncTaxTable *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GncTaxTable *) c_object);
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError, "list must contain object of known type with .instance attribute, see base-typemaps.i in SWIG bindings.");
+ g_list_free($1);
+ return NULL;
+ }
+ }
+ } else {
+ PyErr_SetString(PyExc_TypeError, "not a Python list, cannot convert to GList");
+ return NULL;
+ }
+}
+
%typemap(freearg) GncOwner * {
gncOwnerFree($1);
}
diff --git a/common/base-typemaps.i b/common/base-typemaps.i
index fe6f5ef438..42dc4ee3cf 100644
--- a/common/base-typemaps.i
+++ b/common/base-typemaps.i
@@ -23,19 +23,6 @@
\********************************************************************/
%include "constraints.i"
%include <stdint.i>
-#include "gncCustomer.h"
-#include "Account.hpp"
-#include "gnc-lot.h"
-#include "gnc-commodity.h"
-#include "gnc-pricedb.h"
-#include "gncInvoice.h"
-#include "gncEntry.h"
-#include "gncVendor.h"
-#include "gncEmployee.h"
-#include "gncJob.h"
-#include "gncTaxTable.h"
-#include "Split.h"
-#include "Transaction.h"
typedef void * gpointer; // Not sure why SWIG doesn't figure this out.
%typemap(newfree) gchar * "g_free($1);"
@@ -304,76 +291,6 @@ typedef char gchar;
}
}
-%typemap(in) GList *, CommodityList *, SplitList *, AccountList *, LotList *, MonetaryList *, PriceList *, EntryList * {
- $1 = NULL;
- /* Check if is a list */
- if (PyList_Check($input)) {
- int i;
- int size = PyList_Size($input);
- for (i = size - 1; i >= 0; i--) {
- // Get the high-level Python object from bindings/python/gnucash_core.py.
- PyObject *python_object_wrapper = PyList_GetItem($input, i);
- // Get the .instance attribute of the Python object, which is the raw SWIG handle.
- PyObject *python_object = PyObject_GetAttrString(python_object_wrapper, "instance");
- void *c_object;
- // Attempt to convert the SWIG handle into a Gnucash C/C++ object and add it to the GList.
- if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncCustomer *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GncCustomer *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(Account *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (Account *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GNCLot *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GNCLot *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(Split *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (Split *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(Transaction *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (Transaction *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(gnc_commodity *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (gnc_commodity *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(gnc_monetary *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (gnc_monetary *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(gnc_commodity_namespace *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (gnc_commodity_namespace *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GNCPrice *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GNCPrice *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncInvoice *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GncInvoice *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncEntry *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GncEntry *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncVendor *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GncVendor *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncEmployee *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GncEmployee *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncJob *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GncJob *) c_object);
- }
- else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncTaxTable *), SWIG_POINTER_EXCEPTION) == 0) {
- $1 = g_list_prepend($1, (GncTaxTable *) c_object);
- }
- else {
- PyErr_SetString(PyExc_TypeError, "list must contain object of known type with .instance attribute, see base-typemaps.i in SWIG bindings.");
- g_list_free($1);
- return NULL;
- }
- }
- } else {
- PyErr_SetString(PyExc_TypeError, "not a Python list, cannot convert to GList");
- return NULL;
- }
-}
-
%typemap(out) GList *, CommodityList *, SplitList *, AccountList *, LotList *,
MonetaryList *, PriceList *, EntryList * {
gpointer data;
commit e1f03913fd5f92694558a1a92b0d4c62ba6b6f27
Author: Oliver Lok Trevor <featherfeet5436 at gmail.com>
Date: Sat Mar 15 18:56:54 2025 -0400
Added missing include that sometimes causes build errors about INT64_MAX.
diff --git a/gnucash/gnome/dialog-sx-since-last-run.c b/gnucash/gnome/dialog-sx-since-last-run.c
index 433c1184fa..d14f18e854 100644
--- a/gnucash/gnome/dialog-sx-since-last-run.c
+++ b/gnucash/gnome/dialog-sx-since-last-run.c
@@ -35,6 +35,7 @@
#include <config.h>
#include <glib.h>
#include <gtk/gtk.h>
+#include <stdint.h>
#include "dialog-utils.h"
#include "gnc-sx-instance-model.h"
commit 4c52ba3ae59381f04061c2cdee2b1dcfee576df1
Author: Oliver Lok Trevor <featherfeet5436 at gmail.com>
Date: Sun Mar 9 19:42:01 2025 -0400
Added SWIG type translator for C functions that take GList* arguments to autoconvert Python lists of high-level Gnucash core objects. Fixes issue with Customer.ApplyPayment in Python (gncOwnerApplyPaymentSecs in C).
diff --git a/common/base-typemaps.i b/common/base-typemaps.i
index 42dc4ee3cf..fe6f5ef438 100644
--- a/common/base-typemaps.i
+++ b/common/base-typemaps.i
@@ -23,6 +23,19 @@
\********************************************************************/
%include "constraints.i"
%include <stdint.i>
+#include "gncCustomer.h"
+#include "Account.hpp"
+#include "gnc-lot.h"
+#include "gnc-commodity.h"
+#include "gnc-pricedb.h"
+#include "gncInvoice.h"
+#include "gncEntry.h"
+#include "gncVendor.h"
+#include "gncEmployee.h"
+#include "gncJob.h"
+#include "gncTaxTable.h"
+#include "Split.h"
+#include "Transaction.h"
typedef void * gpointer; // Not sure why SWIG doesn't figure this out.
%typemap(newfree) gchar * "g_free($1);"
@@ -291,6 +304,76 @@ typedef char gchar;
}
}
+%typemap(in) GList *, CommodityList *, SplitList *, AccountList *, LotList *, MonetaryList *, PriceList *, EntryList * {
+ $1 = NULL;
+ /* Check if is a list */
+ if (PyList_Check($input)) {
+ int i;
+ int size = PyList_Size($input);
+ for (i = size - 1; i >= 0; i--) {
+ // Get the high-level Python object from bindings/python/gnucash_core.py.
+ PyObject *python_object_wrapper = PyList_GetItem($input, i);
+ // Get the .instance attribute of the Python object, which is the raw SWIG handle.
+ PyObject *python_object = PyObject_GetAttrString(python_object_wrapper, "instance");
+ void *c_object;
+ // Attempt to convert the SWIG handle into a Gnucash C/C++ object and add it to the GList.
+ if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncCustomer *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GncCustomer *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(Account *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (Account *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GNCLot *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GNCLot *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(Split *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (Split *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(Transaction *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (Transaction *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(gnc_commodity *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (gnc_commodity *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(gnc_monetary *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (gnc_monetary *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(gnc_commodity_namespace *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (gnc_commodity_namespace *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GNCPrice *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GNCPrice *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncInvoice *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GncInvoice *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncEntry *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GncEntry *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncVendor *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GncVendor *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncEmployee *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GncEmployee *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncJob *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GncJob *) c_object);
+ }
+ else if (SWIG_ConvertPtr(python_object, &c_object, $descriptor(GncTaxTable *), SWIG_POINTER_EXCEPTION) == 0) {
+ $1 = g_list_prepend($1, (GncTaxTable *) c_object);
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError, "list must contain object of known type with .instance attribute, see base-typemaps.i in SWIG bindings.");
+ g_list_free($1);
+ return NULL;
+ }
+ }
+ } else {
+ PyErr_SetString(PyExc_TypeError, "not a Python list, cannot convert to GList");
+ return NULL;
+ }
+}
+
%typemap(out) GList *, CommodityList *, SplitList *, AccountList *, LotList *,
MonetaryList *, PriceList *, EntryList * {
gpointer data;
Summary of changes:
bindings/python/gnucash_core.i | 31 +++++++++++++++++++++++++++++++
bindings/python/tests/test_business.py | 11 +++++++++++
2 files changed, 42 insertions(+)
More information about the gnucash-changes
mailing list