RSS/Atom feed Twitter
Site is read-only, email is disabled

python api leak

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

2 of 2 messages available
Toggle history

Please log in to manage your subscriptions.

python api leak Campbell Barton 16 Aug 12:25
  python api leak Manish Singh 30 Sep 10:40
Campbell Barton
2007-08-16 12:25:17 UTC (over 17 years ago)

python api leak

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.

Manish Singh
2007-09-30 10:40:52 UTC (about 17 years ago)

python api leak

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