<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><br id="lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On Mar 8, 2025, at 14:57, Oliver Trevor <olt@mit.edu> wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;">Hello Gnucash developers,</div><div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;"><br></div><div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;">      I was attempting to use the Gnucash Python bindings to apply payments to a list of invoices using Customer.ApplyPayment (which maps to gncOwnerApplyPaymentSecs on the C side), but it gives an error "TypeError: in method 'gncOwnerApplyPaymentSecs', argument 3 of type 'GList *'" when I attempt to pass a Python list of lots as the second argument "lots" (third argument on the C side).</div><div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;"><br></div><div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;">     Looking at how the SWIG bindings were written, I think the issue may be that there is not a type translator that turns Python lists into GList. base-typemaps.i has a SWIG type translator on line 269 that converts Python lists into GSList objects, but as far as I can tell there isn't one that converts Python lists into GList objects.</div><div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;"><br></div><div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;">     Am I correct that this is an issue, or am I missing how the bindings are intended to be used? If it's an issue, I could work on a PR to add a type translator for GList. Also, has anybody ever tried making bindings using GObject introspection instead of SWIG, since Gnucash's API is already GLib-based?</div></div></blockquote><br></div><div>Oliver,</div><div><br></div><div>Looks to like you’re right. There are several SCM List <-> GList* typemaps but only a typemap(out) for Python, not useful for passing arguments into a C function. Go ahead and write a PR.</div><div><br></div><div>I don’t think anyone has considered GI. While somebody made a start on GI bindings for Guile (<a href="https://github.com/spk121/guile-gi">https://github.com/spk121/guile-gi</a>) it’s a fairly recent (started in 2019) project and seems to have been abandoned a couple of years ago. Meanwhile on the GnuCash side while it’s true that we have GObject-based classes,  their memory management wasn’t done correctly and probably wouldn’t integrate well with GI. Our long-term goal is to reimplement them as C++ objects.</div><div><br></div><div>Regards,</div><div>John Ralls</div><br></body></html>