After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 703897 - Functions which can return null always return a Python object
Functions which can return null always return a Python object
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Python Bindings
git-master
Other Linux
: Normal normal
: ---
Assigned To: gnucash-core-maint
gnucash-core-maint
Depends on:
Blocks:
 
 
Reported: 2013-07-09 18:47 UTC by Tom Lofts
Modified: 2018-06-29 23:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to resolve bug (1.10 KB, patch)
2013-07-09 18:55 UTC, Tom Lofts
committed Details | Review

Description Tom Lofts 2013-07-09 18:47:30 UTC
Certain Gucash internal functions are capable of returning null under certain circumstances e.g. xaccSplitGetOtherSplit normally returns a split, but if the split passed in is part of a transaction with multiple splits it will return null instead.

The Python helper functions currently don’t support this behaviour and will always return the type of object set for them to return in gnucash_core.py e.g. the Split class has a function GetOtherSplit defined as returning a Split. If there is no other split, a Split object is returned rather than None, and attempting to use this object can cause segfaults.

I have produced a small patch which alters the Python bindings to check if the object in question is actually none, and resolve this issue, but I am unfamiliar with this part of the Python bindings so would value input from anyone else with more experience in this area.

Kind regards,

Tom
Comment 1 Tom Lofts 2013-07-09 18:55:25 UTC
Created attachment 248767 [details] [review]
Patch to resolve bug
Comment 2 John Ralls 2013-08-02 18:09:34 UTC
Comment on attachment 248767 [details] [review]
Patch to resolve bug

Committed to trunk: r23116.

Thanks.
Comment 3 John Ralls 2018-06-29 23:17:17 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=703897. Please update any external references or bookmarks.