File: /usr/include/pygtk-2.0/pygobject.h
Function: pygobject_init
Error: ob_refcnt of '*cobject' is 1 too high
306 static inline PyObject *
307 pygobject_init(int req_major, int req_minor, int req_micro)
308 {
309     PyObject *gobject, *cobject;
310     
311     gobject = PyImport_ImportModule("gobject");
when PyImport_ImportModule() succeeds
312     if (!gobject) {
taking False path
313         if (PyErr_Occurred())
314         {
315             PyObject *type, *value, *traceback;
316             PyObject *py_orig_exc;
317             PyErr_Fetch(&type, &value, &traceback);
318             py_orig_exc = PyObject_Repr(value);
319             Py_XDECREF(type);
320             Py_XDECREF(value);
321             Py_XDECREF(traceback);
322 
323 
324 #if PY_VERSION_HEX < 0x03000000
325             PyErr_Format(PyExc_ImportError,
326                          "could not import gobject (error was: %s)",
327                          PyString_AsString(py_orig_exc));
328 #else
329             {
330                 /* Can not use PyErr_Format because it doesn't have
331                  * a format string for dealing with PyUnicode objects
332                  * like PyUnicode_FromFormat has
333                  */
334                 PyObject *errmsg = PyUnicode_FromFormat("could not import gobject (error was: %U)",
335                                                         py_orig_exc);
336 
337                 if (errmsg) {
338                    PyErr_SetObject(PyExc_ImportError,
339                                    errmsg);
340                    Py_DECREF(errmsg);
341                 }
342                 /* if errmsg is NULL then we might have OOM
343                  * PyErr should already be set and trying to
344                  * return our own error would be futile
345                  */
346             }
347 #endif
348             Py_DECREF(py_orig_exc);
349         } else {
350             PyErr_SetString(PyExc_ImportError,
351                             "could not import gobject (no error given)");
352         }
353         return NULL;
354     }
355 
356     cobject = PyObject_GetAttrString(gobject, "_PyGObject_API");
when PyObject_GetAttrString() succeeds
new ref from call to PyObject_GetAttrString allocated at:     cobject = PyObject_GetAttrString(gobject, "_PyGObject_API");
ob_refcnt is now refs: 1 + N where N >= 0
357 #if PY_VERSION_HEX >= 0x03000000
358     if (cobject && PyCapsule_CheckExact(cobject))
359         _PyGObject_API = (struct _PyGObject_Functions *) PyCapsule_GetPointer(cobject, "gobject._PyGObject_API");
360 
361 #else
362     if (cobject && PyCObject_Check(cobject))
taking True path
taking False path
363         _PyGObject_API = (struct _PyGObject_Functions *) PyCObject_AsVoidPtr(cobject);
364 #endif
365     else {
366         PyErr_SetString(PyExc_ImportError,
calling PyErr_SetString()
367                         "could not import gobject (could not find _PyGObject_API object)");
368         Py_DECREF(gobject);
when taking True path
369         return NULL;
370     }
371 
372     if (req_major != -1)
373     {
374         int found_major, found_minor, found_micro;
375         PyObject *version;
376 
377         version = PyObject_GetAttrString(gobject, "pygobject_version");
378         if (!version)
379             version = PyObject_GetAttrString(gobject, "pygtk_version");
380         if (!version) {
381             PyErr_SetString(PyExc_ImportError,
382                             "could not import gobject (version too old)");
383             Py_DECREF(gobject);
384             return NULL;
385         }
386         if (!PyArg_ParseTuple(version, "iii",
387                               &found_major, &found_minor, &found_micro)) {
388             PyErr_SetString(PyExc_ImportError,
389                             "could not import gobject (version has invalid format)");
390             Py_DECREF(version);
391             Py_DECREF(gobject);
392             return NULL;
393         }
394         Py_DECREF(version);
395         if (req_major != found_major ||
396             req_minor >  found_minor ||
397             (req_minor == found_minor && req_micro > found_micro)) {
398             PyErr_Format(PyExc_ImportError,
399                          "could not import gobject (version mismatch, %d.%d.%d is required, "
400                          "found %d.%d.%d)", req_major, req_minor, req_micro,
401                          found_major, found_minor, found_micro);
402             Py_DECREF(gobject);
403             return NULL;
404         }
405     }
406     return gobject;
407 }
ob_refcnt of '*cobject' is 1 too high
was expecting final ob_refcnt to be N + 0 (for some unknown N)
but final ob_refcnt is N + 1
found 1 similar trace(s) to this