1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
Description: Support numpy2
Author: Alastair McKinstry <mckinstry@debian.org>
Bug-Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1094373
Last-Updated: 2025-02-11
Forwarded: no
Index: pyferret-7.6.5/pyfermod/libpyferret.c
===================================================================
--- pyferret-7.6.5.orig/pyfermod/libpyferret.c
+++ pyferret-7.6.5/pyfermod/libpyferret.c
@@ -42,6 +42,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <setjmp.h>
#include "ferret.h"
#include "ferret_shared_buffer.h"
@@ -1413,7 +1414,7 @@ static PyObject *pyferretGetStrData(PyOb
/* Create a new NumPy String ndarray (Fortran ordering) with the same shape */
strarraydescript = PyArray_DescrNewFromType(NPY_STRING);
- strarraydescript->elsize = maxstrlen;
+ PyDataType_SET_ELSIZE(strarraydescript,maxstrlen);
data_ndarray = (PyArrayObject *) PyArray_Empty(MAX_FERRET_NDIM, shape, strarraydescript, 1);
if ( data_ndarray == NULL ) {
return NULL;
@@ -1455,7 +1456,7 @@ static PyObject *pyferretGetStrData(PyOb
/* Create a new NumPy String ndarray with the bad-data-flag value */
new_shape[0] = 1;
strarraydescript = PyArray_DescrNewFromType(NPY_STRING);
- strarraydescript->elsize = maxstrlen;
+ PyDataType_SET_ELSIZE(strarraydescript, maxstrlen);
badval_ndarray = (PyArrayObject *) PyArray_Empty(1, new_shape, strarraydescript, 0);
if ( badval_ndarray == NULL ) {
Py_DECREF(data_ndarray);
|