Comment 18 for bug 860680

Revision history for this message
Roger James (rogerjames99) wrote :

For a more comprehensive fix that catches all the cases where warning are generated when the global intrepreter lock has been released and _PyThreadState_Current set to NULL, you can try the following patch to pygobject-2.

--- pygobject-2-2.28.6.orig/gobject/gobjectmodule.c
+++ pygobject-2-2.28.6/gobject/gobjectmodule.c
@@ -2307,7 +2307,7 @@ _log_func(const gchar *log_domain,
           const gchar *message,
           gpointer user_data)
 {
- if (G_LIKELY(Py_IsInitialized()))
+ if (G_LIKELY(Py_IsInitialized()) && (NULL != _PyThreadState_Current))
     {
  PyGILState_STATE state;
  PyObject* warning = user_data;

This seems a bit like wallpapering over the cracks, but it was the simplest fix I could come up with.

Roger