slot_sq_length(): squash a leak.

This commit is contained in:
Guido van Rossum 2001-10-01 16:42:49 +00:00
parent 73921b0eec
commit 2611162345

View File

@ -2729,10 +2729,13 @@ slot_sq_length(PyObject *self)
{
static PyObject *len_str;
PyObject *res = call_method(self, "__len__", &len_str, "()");
int len;
if (res == NULL)
return -1;
return (int)PyInt_AsLong(res);
len = (int)PyInt_AsLong(res);
Py_DECREF(res);
return len;
}
SLOT1(slot_sq_concat, "__add__", PyObject *, "O")