-
Notifications
You must be signed in to change notification settings - Fork 139
Open
Description
Trying to update GraalPy in CI of my project (diofant/python-gmp#261) I got a crash, that seems to be related with the following test (working fine before):
with pytest.raises(MemoryError):
pow(mpz(123), 111111111111111111)
Relevant extension code looks like this:
static PyObject *
power(PyObject *self, PyObject *other, PyObject *module)
{
MPZ_Object *res = NULL;
MPZ_Object *u = NULL, *v = NULL;
CHECK_OP(u, self);
CHECK_OP(v, other);
if (Py_IsNone(module)) {
...
res = MPZ_new(0);
int64_t exp;
if (!res || zz_to_i64(&v->z, &exp)
|| zz_pow(&u->z, (uint64_t)exp, &res->z))
{
/* LCOV_EXCL_START */
Py_CLEAR(res);
PyErr_SetNone(PyExc_MemoryError);
/* LCOV_EXCL_STOP */
}
Py_DECREF(u);
Py_DECREF(v);
return (PyObject *)res;
}
...
}
So, I guess something nasty happens with Py_CLEAR or PyErr_SetNone...
Metadata
Metadata
Assignees
Labels
No labels