From fb137807c4a9173a7e591a6a6650fe73889e28f1 Mon Sep 17 00:00:00 2001 From: x-io Technologies Date: Thu, 26 Sep 2024 09:45:37 +0100 Subject: [PATCH] Fix quaternion_get_wxyz --- Python/Python-C-API/Quaternion.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Python/Python-C-API/Quaternion.h b/Python/Python-C-API/Quaternion.h index 410c938..aaa8a4e 100644 --- a/Python/Python-C-API/Quaternion.h +++ b/Python/Python-C-API/Quaternion.h @@ -40,7 +40,10 @@ static void quaternion_free(Quaternion *self) { static PyObject *quaternion_get_wxyz(Quaternion *self) { const npy_intp dims[] = {4}; - return PyArray_SimpleNewFromData(1, dims, NPY_FLOAT, self->quaternion.array); + PyObject* array = PyArray_SimpleNewFromData(1, dims, NPY_FLOAT, self->quaternion.array); + Py_INCREF(self); + PyArray_SetBaseObject((PyArrayObject *) array, self); + return array; } static PyObject *quaternion_get_w(Quaternion *self) {