Memory leak in C implementation of object proxy when instance method called via class and instance passed in explicitly.

This commit is contained in:
Graham Dumpleton
2013-09-19 22:15:44 +10:00
parent 44b7a3606d
commit e3d8dc8559
2 changed files with 9 additions and 6 deletions

View File

@@ -6,6 +6,11 @@ Version 1.2.0
**Bugs Fixed**
* Python object memory leak was occuring due to incorrect increment of
object reference count in C implementation of object proxy when an
instance method was called via the class and the instance passed in
explicitly.
* In place operators in pure Python object proxy for __idiv__ and
__itruediv__ were not replacing the wrapped object with the result
of the operation on the wrapped object.

View File

@@ -1939,13 +1939,11 @@ static PyObject *WraptBoundMethodWrapper_call(
object = PyObject_CallFunction(partial, "(OO)",
self->object_proxy.wrapped, instance);
if (object) {
Py_INCREF(object);
wrapped = object;
}
else
if (!object)
return NULL;
wrapped = object;
param_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args));
if (!param_args)
return NULL;
@@ -1971,7 +1969,7 @@ static PyObject *WraptBoundMethodWrapper_call(
Py_DECREF(call_args);
Py_XDECREF(param_args);
Py_XDECREF(param_kwds);
Py_XDECREF(wrapped);
Py_DECREF(wrapped);
return result;
}