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:
parent
2740812970
commit
f778ee19df
4 changed files with 105 additions and 2 deletions
|
|
@ -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; \
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue