Skip to content

Commit f1d256d

Browse files
committed
Pull request #5: Migrate PyArray(Map|Neighborhood|Multi)_Type and PyArrayFlags_Type to HPy
Merge hpy-convert-iter to labs-hpy-port * commit '00f4a563fd73d4aab3fd5fd0cd65320d9c844e3e': Remove _PyArrayMapIter_Type_p, make PyArrayMapIter_Type a pointer and define storage for it in mapping.c Convert PyArrayFlags to pure HPy type Convert PyArrayMultiIter_Type to legacy HPy type Convert PyArrayNeighborhoodIter_Type to legacy HPy type Convert PyArrayMapIter_Type to legacy HPy type Convert PyArrayIter_Type to legacy HPy type
2 parents bae1ad4 + 00f4a56 commit f1d256d

File tree

11 files changed

+510
-356
lines changed

11 files changed

+510
-356
lines changed

numpy/core/code_generators/generate_numpy_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
npy_bool obval;
1616
} PyBoolScalarObject;
1717
18-
extern NPY_NO_EXPORT PyTypeObject PyArrayMapIter_Type;
19-
extern NPY_NO_EXPORT PyTypeObject PyArrayNeighborhoodIter_Type;
18+
extern NPY_NO_EXPORT PyTypeObject *PyArrayMapIter_Type;
19+
extern NPY_NO_EXPORT PyTypeObject *PyArrayNeighborhoodIter_Type;
2020
extern NPY_NO_EXPORT PyBoolScalarObject _PyArrayScalar_BoolValues[2];
2121
2222
%s

numpy/core/code_generators/numpy_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
# the following also defines PyArrayDescr_TypeFull (Full appended)
3636
#'PyArrayDescr_Type': (3, "PyArray_DTypeMeta"),
3737
'PyArrayDescr_Type': (3, None, "&PyArrayDescr_Type"),
38-
'PyArrayFlags_Type': (4,),
39-
'PyArrayIter_Type': (5,),
40-
'PyArrayMultiIter_Type': (6,),
38+
'PyArrayFlags_Type': (4, None, "_PyArrayFlags_Type_p"),
39+
'PyArrayIter_Type': (5, None, "_PyArrayIter_Type_p"),
40+
'PyArrayMultiIter_Type': (6, None, "_PyArrayMultiIter_Type_p"),
4141
'PyBoolArrType_Type': (8,),
4242
'PyGenericArrType_Type': (10,),
4343
'PyNumberArrType_Type': (11,),

numpy/core/include/numpy/ndarraytypes.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,10 +797,12 @@ HPyArray_AsFields(HPyContext *ctx, HPy h)
797797
/* Array Flags Object */
798798
typedef struct PyArrayFlagsObject {
799799
PyObject_HEAD
800-
PyObject *arr;
800+
HPyField arr;
801801
int flags;
802802
} PyArrayFlagsObject;
803803

804+
HPyType_HELPERS(PyArrayFlagsObject);
805+
804806
/* Mirrors buffer object to ptr */
805807

806808
typedef struct {

numpy/core/src/multiarray/arrayobject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ array_might_be_written(PyArrayObject *obj);
2828
static const int NPY_ARRAY_WARN_ON_WRITE = (1 << 31);
2929

3030
extern NPY_NO_EXPORT HPyType_Spec PyArray_Type_spec;
31+
extern NPY_NO_EXPORT HPyType_Spec PyArrayFlags_Type_Spec;
3132

3233
#endif /* NUMPY_CORE_SRC_MULTIARRAY_ARRAYOBJECT_H_ */

0 commit comments

Comments
 (0)