Skip to content

Commit

Permalink
Probably correct fix for multiiter size
Browse files Browse the repository at this point in the history
Thanks to Sebastian's comments at:

numpy/numpy#26765 (comment)
  • Loading branch information
matthew-brett committed Oct 3, 2024
1 parent 4815127 commit 3ea60ee
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/fff_python_wrapper/fffpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,13 +523,11 @@ fffpy_multi_iterator* fffpy_multi_iterator_new(int narr, int axis, ...)

/* Create new instance */
thisone = (fffpy_multi_iterator*)malloc(sizeof(fffpy_multi_iterator));
/* Size of PyArrayMultiIterObject no longer guaranteed.
/* Static size of PyArrayMultiIterObject.
*
* Add arbitrary overhead to allow for this.
*
* https://github.com/numpy/numpy/issues/26765#issuecomment-2189047480
* https://github.com/numpy/numpy/issues/26765#issuecomment-2391737671
*/
multi = PyArray_malloc(sizeof(PyArrayMultiIterObject) * 2);
multi = PyArray_malloc(PyArrayMultiIter_Type.tp_basicsize);
vector = (fff_vector**)malloc(narr*sizeof(fff_vector*));

/* Initialize the PyArrayMultiIterObject instance from the variadic arguments */
Expand Down

0 comments on commit 3ea60ee

Please sign in to comment.