Python builtin hashfunc closure fix

If the wrong return type in the hash function was used, an error:
  SystemError: error return without exception set
was raised

Add some tests for testing builtin slots
This commit is contained in:
William S Fulton 2016-08-16 19:39:51 +01:00
commit f778ee19df
4 changed files with 105 additions and 2 deletions

View file

@ -192,9 +192,11 @@ wrapper##_closure(PyObject *a) { \
PyObject *pyresult; \
long result; \
pyresult = wrapper(a, NULL); \
if (!pyresult || !PyLong_Check(pyresult)) \
return -1; \
if (!pyresult) \
return -1; \
result = PyLong_AsLong(pyresult); \
if (PyErr_Occurred()) \
result = -1; \
Py_DECREF(pyresult); \
return result; \
}