From: Tim Peters Date: Sat, 7 Dec 2002 02:28:17 +0000 (+0000) Subject: Backport from head. X-Git-Tag: v2.2.3c1~205 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5e016f449194b281bfa054d099a99dd188b64e09;p=thirdparty%2FPython%2Fcpython.git Backport from head. slot_tp_hash(): In the normal path, this leaked a reference to the integer hash object returned by __hash__(). --- diff --git a/Objects/typeobject.c b/Objects/typeobject.c index db25705c2445..e8ba871872ff 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3278,19 +3278,19 @@ slot_tp_str(PyObject *self) static long slot_tp_hash(PyObject *self) { - PyObject *func, *res; + PyObject *func; static PyObject *hash_str, *eq_str, *cmp_str; - long h; func = lookup_method(self, "__hash__", &hash_str); if (func != NULL) { - res = PyEval_CallObject(func, NULL); + PyObject *res = PyEval_CallObject(func, NULL); Py_DECREF(func); if (res == NULL) return -1; h = PyInt_AsLong(res); + Py_DECREF(res); } else { PyErr_Clear();