Sorry to bother you again, Phil :) I think I may have stumbled onto another
SIP bug, however, as I got a crash in a debug-built Python 2.6, due to a
negative reference count for my extension module. According to the Python
documentation, objects returned from Py_InitModule are borrowed, so one
should increment their reference count. So I patched sip to do just that,
and the problem went away.

Arve
diff -ru sip-4.8-old/sipgen/gencode.c sip-4.8/sipgen/gencode.c
--- sip-4.8-old/sipgen/gencode.c	2009-06-13 17:16:07.000000000 +0200
+++ sip-4.8/sipgen/gencode.c	2009-06-13 19:42:51.000000000 +0200
@@ -848,6 +848,7 @@
 "    if (sipModule == NULL)\n"
 "        SIP_MODULE_RETURN(NULL);\n"
 "\n"
+"    Py_INCREF(sipModule);\n"
 "    sipModuleDict = PyModule_GetDict(sipModule);\n"
 "\n"
         , pt->module->fullname->text);
@@ -1818,6 +1819,7 @@
 "    if (sipModule == NULL)\n"
 "        SIP_MODULE_RETURN(NULL);\n"
 "\n"
+"    Py_INCREF(sipModule);\n"
 "    sipModuleDict = PyModule_GetDict(sipModule);\n"
 "\n"
         );
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to