Loading src/shared_array.h +5 −0 Original line number Diff line number Diff line Loading @@ -58,4 +58,9 @@ extern PyObject *shared_array_list(PyObject *self, PyObject *args); extern int open_file(const char *name, int flags, mode_t mode); extern int unlink_file(const char *name); /* Numpy compability */ #if NPY_ABI_VERSION < 0x02000000 #define PyDataType_ELSIZE(descr) ((descr)->elsize) #endif #endif /* !__SHARED_ARRAY_H__ */ src/shared_array_create.c +4 −4 Original line number Diff line number Diff line Loading @@ -55,14 +55,14 @@ static PyObject *do_create(const char *name, int ndims, npy_intp *dims, PyArray_ } /* Panic if the element size is zero. */ if (dtype->elsize == 0) { if (PyDataType_ELSIZE(dtype) == 0) { PyErr_Format(PyExc_ValueError, "unsupported data type has element size of 0!"); return NULL; } /* Calculate the memory size of the array */ size = dtype->elsize; size = PyDataType_ELSIZE(dtype); for (i = 0; i < ndims; i++) size *= dims[i]; Loading Loading @@ -98,7 +98,7 @@ static PyObject *do_create(const char *name, int ndims, npy_intp *dims, PyArray_ strncpy(meta->magic, SHARED_ARRAY_MAGIC, sizeof (meta->magic)); meta->size = size; meta->typenum = dtype->type_num; meta->itemsize = dtype->elsize; meta->itemsize = PyDataType_ELSIZE(dtype); meta->ndims = ndims; for (i = 0; i < ndims; i++) meta->dims[i] = dims[i]; Loading @@ -112,7 +112,7 @@ static PyObject *do_create(const char *name, int ndims, npy_intp *dims, PyArray_ /* Create the array object */ array = PyArray_New(&PyArray_Type, ndims, dims, dtype->type_num, NULL, map_addr, dtype->elsize, NULL, map_addr, PyDataType_ELSIZE(dtype), NPY_ARRAY_CARRAY, NULL); /* Attach MapOwner to the array */ Loading Loading
src/shared_array.h +5 −0 Original line number Diff line number Diff line Loading @@ -58,4 +58,9 @@ extern PyObject *shared_array_list(PyObject *self, PyObject *args); extern int open_file(const char *name, int flags, mode_t mode); extern int unlink_file(const char *name); /* Numpy compability */ #if NPY_ABI_VERSION < 0x02000000 #define PyDataType_ELSIZE(descr) ((descr)->elsize) #endif #endif /* !__SHARED_ARRAY_H__ */
src/shared_array_create.c +4 −4 Original line number Diff line number Diff line Loading @@ -55,14 +55,14 @@ static PyObject *do_create(const char *name, int ndims, npy_intp *dims, PyArray_ } /* Panic if the element size is zero. */ if (dtype->elsize == 0) { if (PyDataType_ELSIZE(dtype) == 0) { PyErr_Format(PyExc_ValueError, "unsupported data type has element size of 0!"); return NULL; } /* Calculate the memory size of the array */ size = dtype->elsize; size = PyDataType_ELSIZE(dtype); for (i = 0; i < ndims; i++) size *= dims[i]; Loading Loading @@ -98,7 +98,7 @@ static PyObject *do_create(const char *name, int ndims, npy_intp *dims, PyArray_ strncpy(meta->magic, SHARED_ARRAY_MAGIC, sizeof (meta->magic)); meta->size = size; meta->typenum = dtype->type_num; meta->itemsize = dtype->elsize; meta->itemsize = PyDataType_ELSIZE(dtype); meta->ndims = ndims; for (i = 0; i < ndims; i++) meta->dims[i] = dims[i]; Loading @@ -112,7 +112,7 @@ static PyObject *do_create(const char *name, int ndims, npy_intp *dims, PyArray_ /* Create the array object */ array = PyArray_New(&PyArray_Type, ndims, dims, dtype->type_num, NULL, map_addr, dtype->elsize, NULL, map_addr, PyDataType_ELSIZE(dtype), NPY_ARRAY_CARRAY, NULL); /* Attach MapOwner to the array */ Loading