On Thu, Aug 16, 2007 at 08:25:17PM +1000, Campbell Barton wrote:
> was looking at the gimps python API, svn - gimp-pdb.c:311
>
> GimpParam *
> pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int
> nparams)
> {
> PyObject *tuple, *item, *r, *g, *b, *x, *y, *w, *h;
> GimpParam *ret;
> int i, j, len;
> gint32 *i32a; gint16 *i16a; guint8 *i8a; gdouble *fa; gchar **sa;
>
> if (nparams == 0)
> tuple = PyTuple_New(0);
> else if (!PyTuple_Check(args) && nparams == 1)
> tuple = Py_BuildValue("(O)", args);
> else {
> Py_INCREF(args);
> tuple = args;
> }
> if (!PyTuple_Check(tuple)) {
> PyErr_SetString(PyExc_TypeError, "wrong type of parameter");
> return NULL;
> }
>
> if (PyTuple_Size(tuple) != nparams) {
> PyErr_SetString(PyExc_TypeError, "wrong number of parameters");
> return NULL;
> }
> --- snip
>
> Notice that tuple is always created, but error values dont free, I think
> both "return NULL;"'s need a Py_DECREF(tuple); before them.
Thanks for noticing, you are indeed correct. This is now fixed in SVN.
Next time, filing a bug in bugzilla with a patch for these obvious sorts
of things would be much preferred.
-Yosh
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer