[PATCH] python bindings stability by going without guile
Mark Jenkins
mark at parit.ca
Wed Jun 16 11:20:38 EDT 2010
Attached is a patch that appears to improve stability for the python
bindings.
Instead of initializing guile and using the gnucash module loading
mechanisms, I directly link to all needed modules and just use the
direct initialization functions in pretty much the same way that
Cutecash does.
I've been doing some work with the bindings for business objects
(invoice creation), for which I'll be submitting additional patches
later today. Applying this stability patch has made the difference
between seg faulting and things actually working.
Christoph, I wonder if this helps with the stack blow out problems
you've been having?
I also had a similar problem with a more complex python application and
even ended up kludging things to the point where I was moving my "from
gnucash import" statements to the inside of functions instead of at the
top of programs to avoid similar trouble. I'll get around to testing if
this patch helps that at some point, it will take me awhile because I'll
to port my application to use python bindings in gnucash trunk instead
of my 2.2 python bindings patches. [the api has changed]
The following earlier patch (/python bindings and lost business data/)
can be disregarded:
http://lists.gnucash.org/pipermail/gnucash-devel/2010-June/028760.html
This current patch also addresses the same lack of module init/load for
writing business objects that the above patch addressed.
The crazy part here is that I can't actually pin down why things were so
unstable before and what improvement this makes. We can guess:
* That linking and running guile from a python module that is loaded
by the python interpreter is bad for some reason, possibly due to some
bug in guile or python
* That I was linking to or initializing guile improperly before
The downside to this patch is the warnings it causes:
"""
*** Warning: Linking the shared library _gnucash_core_c.la against the
loadable module
*** libgncmod-backend-xml.so is not portable!
*** Warning: Linking the shared library _gnucash_core_c.la against the
loadable module
*** libgncmod-business-backend-xml.so is not portable!
*** Warning: Linking the shared library _gnucash_core_c.la against the
loadable module
*** libgncmod-backend-dbi.so is not portable!
*** Warning: Linking the shared library _gnucash_core_c.la against the
loadable module
*** libgncmod-business-backend-sql.so is not portable!
"""
Christian elaborates on this and suggests that these should become
normal shared libraries or part of one larger one
http://lists.gnucash.org/pipermail/gnucash-devel/2010-June/028790.html
(Thanks by the way for adding gnc_module_init_business_core_sql_init() !)
Mark Jenkins
ParIT Worker Co-op
cc Christoph Holtermann
cc Christian Stimming
cc fellow ParITistas
bcc friendly funder of all this
p.s. in addition to finding them posted here, all my python bindings
patches can be accessed by pointing your svn client at:
http://svn.parit.ca/gnucash/branches/python-bindings/
and you can get all of them as a full patch against trunk by
svn diff http://svn.parit.ca/gnucash/trunk/
http://svn.parit.ca/gnucash/branches/python-bindings/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: python_bindings_stability_without_guile.patch
Type: text/x-diff
Size: 2624 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20100616/33ac8cee/attachment.bin>
More information about the gnucash-devel
mailing list