mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-140406: Fix memory leak upon __hash__ returning a non-integer (GH-140411)
This commit is contained in:
parent
fe4b60208e
commit
71db05a12d
3 changed files with 13 additions and 0 deletions
|
|
@ -10569,6 +10569,7 @@ slot_tp_hash(PyObject *self)
|
|||
return PyObject_HashNotImplemented(self);
|
||||
}
|
||||
if (!PyLong_Check(res)) {
|
||||
Py_DECREF(res);
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"__hash__ method should return an integer");
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue