[GNC-dev] Python Binding: GncOwner fails to convert from C->Python->C

Steve Brown sbrown at opensat.com
Sun Jan 29 08:38:58 EST 2023


I get a Python GncOwner object returned to Python. It appears well
formed.

owner:  <class 'gnucash.gnucash_core.GncOwner'> <gnucash.gnucash_core.GncOwner object at 0x7f33d4cc3050>
owner_instance:  <class 'tuple'> (4, <Swig Object of type 'GncVendor *' at 0x7f214b5a9500>)

It's not clear how to easily inspect the Swig object.

However, the object doesn't convert back to C. It's not recognized as
GncVendor.

I get:

ValueError: Python object passed to function with GncOwner * argument couldn't be converted back to pointer of that type

The out typemap for GncOwner looks correct. However, I can't see how
the in typemap gets the swig wrapper object from the tuple created by
the out typemap. 
 
I can recreate the problem in simple_business_create.py with the
attached patch.

If there is nothing obviously wrong with the typemaps, how should I go
about debugging this?

Thanks,
Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getaddr.patch
Type: text/x-patch
Size: 803 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20230129/e3247ff4/attachment.bin>


More information about the gnucash-devel mailing list