Fix hash function type checking for older versions of Python
Python 2.6 was asserting instead of throwing a Python TypeError.
This commit is contained in:
parent
17d68afedd
commit
253a39fdff
1 changed files with 4 additions and 1 deletions
|
|
@ -194,7 +194,10 @@ wrapper##_closure(PyObject *a) { \
|
|||
pyresult = wrapper(a, NULL); \
|
||||
if (!pyresult) \
|
||||
return -1; \
|
||||
result = PyLong_AsLong(pyresult); \
|
||||
if (!PyLong_Check(pyresult)) \
|
||||
PyErr_Format(PyExc_TypeError, "Wrong type for hash function");\
|
||||
else \
|
||||
result = PyLong_AsLong(pyresult); \
|
||||
if (PyErr_Occurred()) \
|
||||
result = -1; \
|
||||
Py_DECREF(pyresult); \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue