Fix a leak in instance_coerce(). This was introduced by Neil's

earlier coercion changes, not by rich comparisons.  When a coercion
function returns 1 (meaning it cannot do it), it should not INCREF the
arguments.  When no __coerce__() method was found, instance_coerce()
originally returned 0, pretending it did it.  Neil changed the return
value to 1, more accurately reflecting that it didn't do anything, but
forgot to take out the two INCREF calls.
This commit is contained in:
Guido van Rossum 2001-01-17 23:43:43 +00:00
parent 97c9640cc9
commit 24f67d568c
1 changed files with 0 additions and 2 deletions

View File

@ -1289,8 +1289,6 @@ instance_coerce(PyObject **pv, PyObject **pw)
if (coercefunc == NULL) {
/* No __coerce__ method */
PyErr_Clear();
Py_INCREF(v);
Py_INCREF(w);
return 1;
}
/* Has __coerce__ method: call it */