-1 is reserved for errors

This commit is contained in:
Benjamin Peterson 2010-10-17 21:27:01 +00:00
parent e6baa46aab
commit e7dfeeb889
1 changed files with 3 additions and 0 deletions

View File

@ -4959,6 +4959,9 @@ slot_tp_hash(PyObject *self)
PyErr_Clear();
h = PyLong_Type.tp_hash(res);
}
/* -1 is reserved for errors. */
if (h == -1)
h = -2;
Py_DECREF(res);
return h;
}