[Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.28,2.126.4.29
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Fri, 06 Dec 2002 18:28:20 -0800
Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv20552/22/Objects
Modified Files:
Tag: release22-maint
typeobject.c
Log Message:
Backport from head.
slot_tp_hash(): In the normal path, this leaked a reference to the
integer hash object returned by __hash__().
Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.126.4.28
retrieving revision 2.126.4.29
diff -C2 -d -r2.126.4.28 -r2.126.4.29
*** typeobject.c 18 Oct 2002 16:45:38 -0000 2.126.4.28
--- typeobject.c 7 Dec 2002 02:28:17 -0000 2.126.4.29
***************
*** 3279,3285 ****
slot_tp_hash(PyObject *self)
{
! PyObject *func, *res;
static PyObject *hash_str, *eq_str, *cmp_str;
-
long h;
--- 3279,3284 ----
slot_tp_hash(PyObject *self)
{
! PyObject *func;
static PyObject *hash_str, *eq_str, *cmp_str;
long h;
***************
*** 3287,3295 ****
if (func != NULL) {
! res = PyEval_CallObject(func, NULL);
Py_DECREF(func);
if (res == NULL)
return -1;
h = PyInt_AsLong(res);
}
else {
--- 3286,3295 ----
if (func != NULL) {
! PyObject *res = PyEval_CallObject(func, NULL);
Py_DECREF(func);
if (res == NULL)
return -1;
h = PyInt_AsLong(res);
+ Py_DECREF(res);
}
else {