]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix a leak in instance_coerce(). This was introduced by Neil's
authorGuido van Rossum <guido@python.org>
Wed, 17 Jan 2001 23:43:43 +0000 (23:43 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 17 Jan 2001 23:43:43 +0000 (23:43 +0000)
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.

Objects/classobject.c

index 7f76d6ed5ab458812c6ad03092d637953a860b47..5e987ff6b8bf6b29e5b4a433fb5662b1d4e9f165 100644 (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 */