From f54d8b7d751d927dd657788feea2745a3045fe7a Mon Sep 17 00:00:00 2001 From: Ollie Copping Date: Thu, 27 Jun 2024 09:29:26 +0100 Subject: [PATCH] Added PyArrayObject cast to some lines --- src/pvxs_value.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pvxs_value.cpp b/src/pvxs_value.cpp index 0dc47c85..4ab07a88 100644 --- a/src/pvxs_value.cpp +++ b/src/pvxs_value.cpp @@ -236,7 +236,7 @@ Value inferPy(PyObject* py) else if(PyList_Check(py)) code = TypeCode::StringA; else if(PyArray_Check(py)) { - switch(PyArray_TYPE(py)) { + switch(PyArray_TYPE((PyArrayObject*)py)) { #define CASE(NTYPE, PTYPE) case NTYPE: code = TypeCode::PTYPE; break CASE(NPY_BOOL, BoolA); // bool stored as one byte CASE(NPY_INT8, Int8A); @@ -532,12 +532,12 @@ void storePy(Value& v, PyObject* py, bool forceCast) PyRef arr(PyArray_FromAny(py, PyArray_DescrFromType(ntype), 0, 0, NPY_CARRAY_RO|NPY_ARRAY_FORCECAST, nullptr)); - if(PyArray_NDIM(arr.obj)!=1) + if(PyArray_NDIM((PyArrayObject*)arr.obj)!=1) throw std::logic_error("Only 1-d array can be assigned"); - auto dest(allocArray(v.type().arrayType(), PyArray_DIM(arr.obj, 0))); + auto dest(allocArray(v.type().arrayType(), PyArray_DIM((PyArrayObject*)arr.obj, 0))); - memcpy(dest.data(), PyArray_DATA(arr.obj), PyArray_NBYTES(arr.obj)); + memcpy(dest.data(), PyArray_DATA((PyArrayObject*)arr.obj), PyArray_NBYTES((PyArrayObject*)arr.obj)); v = dest.freeze(); return;