From 6eaf10b2197461ada988d3aa7a2a86f6b3f9f7ab Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Thu, 9 Feb 2023 15:55:27 +0100 Subject: DOC: Add code comment about why flags are not used in refcount.c We simply don't bother releasing the GIL right now. This could make sense in principle for some user dtypes, though. (NumPy only ever uses clearing with Python objects so the GIL is always needed). I see no plausible use of checking floating point errors, so do not bother to add such cruft, if anyone ever needs it, they should add it. --- numpy/core/src/multiarray/refcount.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'numpy/core/src') diff --git a/numpy/core/src/multiarray/refcount.c b/numpy/core/src/multiarray/refcount.c index 8c2399610..e735e3b8f 100644 --- a/numpy/core/src/multiarray/refcount.c +++ b/numpy/core/src/multiarray/refcount.c @@ -44,9 +44,10 @@ PyArray_ClearBuffer( } NPY_traverse_info clear_info; - NPY_ARRAYMETHOD_FLAGS flags; + /* Flags unused: float errors do not matter and we do not release GIL */ + NPY_ARRAYMETHOD_FLAGS flags_unused; if (PyArray_GetClearFunction( - aligned, stride, descr, &clear_info, &flags) < 0) { + aligned, stride, descr, &clear_info, &flags_unused) < 0) { return -1; } @@ -96,9 +97,10 @@ PyArray_ClearBuffer( npy_intp inner_stride = strides_it[0]; npy_intp inner_shape = shape_it[0]; NPY_traverse_info clear_info; - NPY_ARRAYMETHOD_FLAGS flags; + /* Flags unused: float errors do not matter and we do not release GIL */ + NPY_ARRAYMETHOD_FLAGS flags_unused; if (PyArray_GetClearFunction( - aligned, inner_stride, descr, &clear_info, &flags) < 0) { + aligned, inner_stride, descr, &clear_info, &flags_unused) < 0) { return -1; } NPY_RAW_ITER_START(idim, ndim, coord, shape_it) { -- cgit v1.2.1