diff options
Diffstat (limited to 'Lib/python/builtin.swg')
-rw-r--r-- | Lib/python/builtin.swg | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/python/builtin.swg b/Lib/python/builtin.swg index 6085980d4..3dd5bbf95 100644 --- a/Lib/python/builtin.swg +++ b/Lib/python/builtin.swg @@ -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); \ |