New submission from Dominic Lavoie <[EMAIL PROTECTED]>:

This issue is similar to issue 1229429. In the called Python method, a 
regular expression fails to compile & PyEval_CallMethod() returns 0. 
However, the reference count is incremented by 1 which prevents the 
object from being destroyed.

Could the problem be in classobject.c, in instancemethod_call() ?

                if (newarg == NULL)
                        return NULL;
                Py_INCREF(self);
                PyTuple_SET_ITEM(newarg, 0, self);
                for (i = 0; i < argcount; i++) {
                        PyObject *v = PyTuple_GET_ITEM(arg, i);
                        Py_XINCREF(v);
                        PyTuple_SET_ITEM(newarg, i+1, v);
                }
                arg = newarg;
        }
        result = PyObject_Call((PyObject *)func, arg, kw);
        Py_DECREF(arg);
        return result;
}

If result is null, should Py_DECREF(self) be called in the case where 
self was non-null ?

----------
components: Interpreter Core
messages: 69474
nosy: dominic.lavoie
severity: normal
status: open
title: When PyObject_CallMethod fails, refcount is incorrect
type: resource usage
versions: Python 2.5

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3328>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to