summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-12-06 23:38:02 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-12-06 23:38:02 (GMT)
commit61ce0a9bae6e97f25034370eda2fe87ef654e434 (patch)
treec89eef31b5b43e07dc904db7388a031c752e13ef /Objects
parentead60e5d1c24f4bd2f53b7994d4240735cc11453 (diff)
downloadcpython-61ce0a9bae6e97f25034370eda2fe87ef654e434.zip
cpython-61ce0a9bae6e97f25034370eda2fe87ef654e434.tar.gz
cpython-61ce0a9bae6e97f25034370eda2fe87ef654e434.tar.bz2
slot_tp_hash(): In the normal path, this leaked a reference to the
integer hash object returned by __hash__(). This accounts for some of the "mystery leaks" in the sandbox datetime tests, but probably not all of them.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 4cfbd49..6129442 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -3941,19 +3941,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();