[PyQt] [SIP][PATCH]Errors occurring during execution of python __dtor__() function called from sip are discarded

Alexis Boutillier alexis.boutillier at arteris.com
Mon Apr 6 09:04:35 BST 2009


Hi,

When sip call the __dtor__() python function on a python object, it does 
not print errors that occurred during the execution of the python function.
If something goes wrong in this function you are not informed and so you 
can leave objects in an unwanted state (because of an attributeError for 
example).

Here is a patch to siplib.c that print the python error if it occurred 
during the call of the python "__dtor__()" function.
Patch is against sip-4.8-snapshot-20090401

--- ./siplib/siplib.c   2009-04-02 04:30:39.000000000 +0200
+++ ../sip-4.8-snapshot-20090401-new/siplib/siplib.c    2009-04-06 
09:43:33.000000000 +0200
@@ -3841,6 +3841,11 @@
          /* Discard any result. */
          Py_XDECREF(res);

+        if (PyErr_Occurred()) {
+            PyErr_Print();
+            PyErr_Clear();
+        }
+
          SIP_RELEASE_GIL(sipGILState);
      }
  }

Regards,
-- 
Boutillier Alexis
Methodology engineer

Arteris SA
The Network-on-Chip Company TM
www.arteris.net

6 par Ariane Immeuble Mercure
78284 Guyancourt Cedex
France
Office: (+33) 1 61 37 38 71
Fax:    (+33) 1 61 37 38 41
Alexis.Boutillier at arteris.net


More information about the PyQt mailing list