branch: master commit 5ddd2b51f5bf0dc7086eadc2ae24230acfc11e8e Author: Konstantinos Poulios <logar...@gmail.com> AuthorDate: Fri Mar 8 00:16:50 2024 +0100
Improve compatibility with MSVC compiler --- interface/src/python/getfem_python.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/interface/src/python/getfem_python.c b/interface/src/python/getfem_python.c index 0f5c6f5d..2a42e844 100644 --- a/interface/src/python/getfem_python.c +++ b/interface/src/python/getfem_python.c @@ -739,7 +739,11 @@ call_getfem_(PyObject *self, PyObject *args, int in__init__) result = Py_None; Py_INCREF(Py_None); } else if (out) { int i, err = 0; +#if defined(_MSC_VER) + PyObject **d = (PyObject **)malloc(out_cnt*sizeof(PyObject*)); +#else PyObject *d[out_cnt]; +#endif for (i = 0; i < out_cnt; ++i) { if (!err && !(d[i] = gfi_array_to_PyObject(out[i], in__init__))) err = 1; @@ -753,6 +757,9 @@ call_getfem_(PyObject *self, PyObject *args, int in__init__) for (i = 0; i < out_cnt; ++i) PyTuple_SET_ITEM(result,i,d[i]); } else result = d[0]; } +#if defined(_MSC_VER) + free(d); +#endif } } }