mirror of
https://github.com/python/cpython.git
synced 2025-11-13 07:26:31 +00:00
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.
This commit is contained in:
parent
ead60e5d1c
commit
61ce0a9bae
1 changed files with 3 additions and 3 deletions
|
|
@ -3941,19 +3941,19 @@ slot_tp_str(PyObject *self)
|
||||||
static long
|
static long
|
||||||
slot_tp_hash(PyObject *self)
|
slot_tp_hash(PyObject *self)
|
||||||
{
|
{
|
||||||
PyObject *func, *res;
|
PyObject *func;
|
||||||
static PyObject *hash_str, *eq_str, *cmp_str;
|
static PyObject *hash_str, *eq_str, *cmp_str;
|
||||||
|
|
||||||
long h;
|
long h;
|
||||||
|
|
||||||
func = lookup_method(self, "__hash__", &hash_str);
|
func = lookup_method(self, "__hash__", &hash_str);
|
||||||
|
|
||||||
if (func != NULL) {
|
if (func != NULL) {
|
||||||
res = PyEval_CallObject(func, NULL);
|
PyObject *res = PyEval_CallObject(func, NULL);
|
||||||
Py_DECREF(func);
|
Py_DECREF(func);
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
h = PyInt_AsLong(res);
|
h = PyInt_AsLong(res);
|
||||||
|
Py_DECREF(res);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue