diff options
Diffstat (limited to 'doc/source/reference/c-api.iterator.rst')
-rw-r--r-- | doc/source/reference/c-api.iterator.rst | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/doc/source/reference/c-api.iterator.rst b/doc/source/reference/c-api.iterator.rst index 392dcb730..940452d3c 100644 --- a/doc/source/reference/c-api.iterator.rst +++ b/doc/source/reference/c-api.iterator.rst @@ -110,7 +110,6 @@ number of non-zero elements in an array. /* Increment the iterator to the next inner loop */ } while(iternext(iter)); - NpyIter_Close(iter) /* best practice, not strictly required in this case */ NpyIter_Deallocate(iter); return nonzero_count; @@ -195,7 +194,6 @@ is used to control the memory layout of the allocated result, typically ret = NpyIter_GetOperandArray(iter)[1]; Py_INCREF(ret); - NpyIter_Close(iter); if (NpyIter_Deallocate(iter) != NPY_SUCCEED) { Py_DECREF(ret); return NULL; @@ -495,7 +493,7 @@ Construction and Destruction per operand. Using ``NPY_ITER_READWRITE`` or ``NPY_ITER_WRITEONLY`` for a user-provided operand may trigger `WRITEBACKIFCOPY`` semantics. The data will be written back to the original array - when ``NpyIter_Close`` is called. + when ``NpyIter_Deallocate`` is called. .. c:var:: NPY_ITER_COPY @@ -507,13 +505,13 @@ Construction and Destruction Triggers :c:data:`NPY_ITER_COPY`, and when an array operand is flagged for writing and is copied, causes the data - in a copy to be copied back to ``op[i]`` when ``NpyIter_Close`` is - called. + in a copy to be copied back to ``op[i]`` when + ``NpyIter_Deallocate`` is called. If the operand is flagged as write-only and a copy is needed, an uninitialized temporary array will be created and then copied - to back to ``op[i]`` on calling ``NpyIter_Close``, instead of doing - the unnecessary copy operation. + to back to ``op[i]`` on calling ``NpyIter_Deallocate``, instead of + doing the unnecessary copy operation. .. c:var:: NPY_ITER_NBO .. c:var:: NPY_ITER_ALIGNED @@ -709,9 +707,7 @@ Construction and Destruction the functions will pass back errors through it instead of setting a Python exception. - :c:func:`NpyIter_Deallocate` must be called for each copy. One call to - :c:func:`NpyIter_Close` is sufficient to trigger writeback resolution for - all copies since they share buffers. + :c:func:`NpyIter_Deallocate` must be called for each copy. .. c:function:: int NpyIter_RemoveAxis(NpyIter* iter, int axis)`` @@ -763,23 +759,9 @@ Construction and Destruction Returns ``NPY_SUCCEED`` or ``NPY_FAIL``. -.. c:function:: int NpyIter_Close(NpyIter* iter) - - Resolves any needed writeback resolution. Should be called before - :c:func::`NpyIter_Deallocate`. After this call it is not safe to use the operands. - When using :c:func:`NpyIter_Copy`, only one call to :c:func:`NpyIter_Close` - is sufficient to resolve any writebacks, since the copies share buffers. - - Returns ``0`` or ``-1`` if unsuccessful. - .. c:function:: int NpyIter_Deallocate(NpyIter* iter) - Deallocates the iterator object. - - :c:func:`NpyIter_Close` should be called before this. If not, and if - writeback is needed, it will be performed at this point in order to maintain - backward-compatibility with older code, and a deprecation warning will be - emitted. Old code should be updated to call `NpyIter_Close` beforehand. + Deallocates the iterator object and resolves any needed writebacks. Returns ``NPY_SUCCEED`` or ``NPY_FAIL``. |