r21603 - gnucash/trunk/src - Avoid warning returning a boolean result in python bindings.

Mike Alexander mta at code.gnucash.org
Mon Nov 21 00:43:29 EST 2011


Author: mta
Date: 2011-11-21 00:43:29 -0500 (Mon, 21 Nov 2011)
New Revision: 21603
Trac: http://svn.gnucash.org/trac/changeset/21603

Modified:
   gnucash/trunk/src/base-typemaps.i
Log:
Avoid warning returning a boolean result in python bindings.

Getting "dereferencing type-punned pointer" doing Py_INCREF on Py_True and Py_False.

Modified: gnucash/trunk/src/base-typemaps.i
===================================================================
--- gnucash/trunk/src/base-typemaps.i	2011-11-20 21:43:23 UTC (rev 21602)
+++ gnucash/trunk/src/base-typemaps.i	2011-11-21 05:43:29 UTC (rev 21603)
@@ -118,13 +118,13 @@
 %typemap(out) gboolean {
     if ($1 == TRUE)
     {
-        Py_INCREF(Py_True);
         $result = Py_True;
+        Py_INCREF($result);
     }
     else if ($1 == FALSE)
     {
-        Py_INCREF(Py_False);
         $result = Py_False;
+        Py_INCREF($result);
     }
     else
     {



More information about the gnucash-changes mailing list