Skip to content

Commit 2359eaf

Browse files
committed
Fix: incorrect signature used for 'wrap_hashfunc'.
1 parent 228c241 commit 2359eaf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

graalpython/com.oracle.graal.python.cext/src/typeobject.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,12 @@ static PyObject* wrap_lenfunc(lenfunc f, PyObject* a) {
170170
return PyLong_FromSsize_t(f(a));
171171
}
172172

173-
static Py_hash_t wrap_hashfunc(hashfunc f, PyObject* a) {
174-
return PyLong_FromSsize_t(f(a));
173+
static PyObject* wrap_hashfunc(hashfunc f, PyObject* a) {
174+
Py_hash_t res = f(a);
175+
if (res == -1 && PyErr_Occurred()) {
176+
return NULL;
177+
}
178+
return PyLong_FromSsize_t(res);
175179
}
176180

177181
static PyObject* wrap_reverse_binop(binaryfunc f, PyObject* a, PyObject* b) {

0 commit comments

Comments
 (0)