Skip to content

Commit b1013fe

Browse files
committed
Fix memory leak upon __hash__ returning a non-integer.
1 parent 9a87ce8 commit b1013fe

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Objects/typeobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10569,6 +10569,7 @@ slot_tp_hash(PyObject *self)
1056910569
return PyObject_HashNotImplemented(self);
1057010570
}
1057110571
if (!PyLong_Check(res)) {
10572+
Py_DECREF(res);
1057210573
PyErr_SetString(PyExc_TypeError,
1057310574
"__hash__ method should return an integer");
1057410575
return -1;

0 commit comments

Comments
 (0)