File: pygstvalue.c
Function: pygst_value_from_pyobject_internal
Error: ob_refcnt of '*pystr' is 1 too high
196 static int
197 pygst_value_from_pyobject_internal (GValue * value, PyObject * obj)
198 {
199   GType f = g_type_fundamental (G_VALUE_TYPE (value));
when treating unknown struct GValue * from pygstvalue.c:197 as non-NULL
200 
201   /* work around a bug in pygtk whereby pyg_value_from_pyobject claims success
202      for unknown fundamental types without actually doing anything */
203   if (f < G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_USER_FIRST)
when considering range: 0 <= value <= 195
taking True path
204       && pyg_value_from_pyobject (value, obj) == 0) {
when treating unknown struct _PyGObject_Functions * from /usr/include/pygtk-2.0/pygobject.h:207 as non-NULL
calling unknown int (*) (struct GValue *, struct PyObject *) from pygstvalue.c:204
when considering range: -0x80000000 <= value <= -1
taking False path
205     return 0;
206   } else if (PyObject_IsInstance (obj, gstvalue_class)) {
when considering range: -0x80000000 <= value <= -1
taking True path
207     PyErr_Clear ();
208 
209     if (PyObject_IsInstance (obj, gstfourcc_class)) {
when considering range: -0x80000000 <= value <= -1
taking True path
210       PyObject *pystr;
211       gchar *str;
212       VALUE_TYPE_CHECK (value, GST_TYPE_FOURCC);
taking False path
when taking True path
taking False path
213       if (!(pystr = PyObject_GetAttrString (obj, "fourcc")))
when PyObject_GetAttrString() succeeds
taking False path
new ref from call to PyObject_GetAttrString allocated at:       if (!(pystr = PyObject_GetAttrString (obj, "fourcc")))
ob_refcnt is now refs: 1 + N where N >= 0
214         return -1;
215       if (!(str = PyString_AsString (pystr)))
when PyString_AsString() succeeds
taking False path
216         return -1;
217       g_assert (strlen (str) == 4);
when considering range: 0 <= value <= 3
taking False path
when considering range: -0x8000000000000000 <= value <= -1
taking True path
218       gst_value_set_fourcc (value, GST_STR_FOURCC (str));
219     } else if (PyObject_IsInstance (obj, gstintrange_class)) {
220       PyObject *pyval;
221       long low, high;
222       VALUE_TYPE_CHECK (value, GST_TYPE_INT_RANGE);
223       if (!(pyval = PyObject_GetAttrString (obj, "low")))
224         return -1;
225       low = PyInt_AsLong (pyval);
226       g_assert (G_MININT <= low && low <= G_MAXINT);
227       if (!(pyval = PyObject_GetAttrString (obj, "high")))
228         return -1;
229       high = PyInt_AsLong (pyval);
230       g_assert (G_MININT <= high && high <= G_MAXINT);
231       gst_value_set_int_range (value, (int) low, (int) high);
232     } else if (PyObject_IsInstance (obj, gstdoublerange_class)) {
233       PyObject *pyval;
234       double low, high;
235       VALUE_TYPE_CHECK (value, GST_TYPE_DOUBLE_RANGE);
236       if (!(pyval = PyObject_GetAttrString (obj, "low")))
237         return -1;
238       low = PyFloat_AsDouble (pyval);
239       if (!(pyval = PyObject_GetAttrString (obj, "high")))
240         return -1;
241       high = PyFloat_AsDouble (pyval);
242       gst_value_set_double_range (value, low, high);
243     } else if (PyObject_IsInstance (obj, gstfraction_class)) {
244       PyObject *pyval;
245       long num, denom;
246       long gcd = 0;
247       VALUE_TYPE_CHECK (value, GST_TYPE_FRACTION);
248       if (!(pyval = PyObject_GetAttrString (obj, "num")))
249         return -1;
250       num = PyInt_AsLong (pyval);
251       if ((num == -1) && PyErr_Occurred ())
252         return -1;
253       g_assert (G_MININT <= num && num <= G_MAXINT);
254       if (!(pyval = PyObject_GetAttrString (obj, "denom")))
255         return -1;
256       denom = PyInt_AsLong (pyval);
257       if ((denom == -1) && PyErr_Occurred ())
258         return -1;
259       /* we need to reduce the values to be smaller than MAXINT */
260       if ((gcd = my_gcd (num, denom))) {
261         num /= gcd;
262         denom /= gcd;
263       }
264       g_assert (G_MININT <= denom && denom <= G_MAXINT);
265       gst_value_set_fraction (value, (int) num, (int) denom);
266     } else if (PyObject_IsInstance (obj, gstfractionrange_class)) {
267       GValue low = { 0, };
268       GValue high = { 0, };
269       PyObject *pylow, *pyhigh;
270 
271       VALUE_TYPE_CHECK (value, GST_TYPE_FRACTION_RANGE);
272       if (!(pylow = PyObject_GetAttrString (obj, "low")))
273         return -1;
274       if (!pygst_value_init_for_pyobject (&low, pylow))
275         return -1;
276       if (pygst_value_from_pyobject (&low, pylow) != 0)
277         return -1;
278 
279       if (!(pyhigh = PyObject_GetAttrString (obj, "high")))
280         return -1;
281       if (!pygst_value_init_for_pyobject (&high, pyhigh))
282         return -1;
283       if (pygst_value_from_pyobject (&high, pyhigh) != 0)
284         return -1;
285 
286       gst_value_set_fraction_range (value, &low, &high);
287     } else {
288       gchar buf[256];
289       gchar *str = PyString_AsString (PyObject_Repr (obj));
290       g_snprintf (buf, 256, "Unknown gst.Value type: %s", str);
291       PyErr_SetString (PyExc_TypeError, buf);
292       return -1;
293     }
294     return 0;
295   } else if (PyObject_IsInstance (obj, (PyObject *) & PyGstMiniObject_Type)) {
296     VALUE_TYPE_CHECK (value, GST_TYPE_MINI_OBJECT);
297     gst_value_set_mini_object (value, pygstminiobject_get (obj));
298     return 0;
299   } else if (PyTuple_Check (obj)) {
300     gint i, len;
301     PyErr_Clear ();
302     VALUE_TYPE_CHECK (value, GST_TYPE_ARRAY);
303     len = PyTuple_Size (obj);
304     for (i = 0; i < len; i++) {
305       PyObject *o;
306       GValue new = { 0, };
307       o = PyTuple_GetItem (obj, i);
308       if (!pygst_value_init_for_pyobject (&new, o))
309         return -1;
310       if (pygst_value_from_pyobject (&new, o) != 0) {
311         g_value_unset (&new);
312         return -1;
313       }
314       gst_value_array_append_value (value, &new);
315       g_value_unset (&new);
316     }
317     return 0;
318   } else if (PyList_Check (obj)) {
319     gint i, len;
320     PyErr_Clear ();
321     VALUE_TYPE_CHECK (value, GST_TYPE_LIST);
322     len = PyList_Size (obj);
323     for (i = 0; i < len; i++) {
324       PyObject *o;
325       GValue new = { 0, };
326       o = PyList_GetItem (obj, i);
327       if (!pygst_value_init_for_pyobject (&new, o))
328         return -1;
329       if (pygst_value_from_pyobject (&new, o) != 0) {
330         g_value_unset (&new);
331         return -1;
332       }
333       gst_value_list_append_value (value, &new);
334       g_value_unset (&new);
335     }
336     return 0;
337   } else {
338     return -1;
339   }
340 }
ob_refcnt of '*pystr' 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 6 similar trace(s) to this