summaryrefslogtreecommitdiff
path: root/doc/source/reference/c-api.array.rst
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2017-12-06 21:08:08 +0200
committermattip <matti.picus@gmail.com>2017-12-06 21:08:08 +0200
commit1ab78a554bb8e368282047bad82326ce1fa4ecb7 (patch)
tree12722a8e8733348381ac78db96f668d1abd2fcf6 /doc/source/reference/c-api.array.rst
parent82deb85915b40e19060186f47396328fcaa85b8f (diff)
downloadnumpy-1ab78a554bb8e368282047bad82326ce1fa4ecb7.tar.gz
document new API function
Diffstat (limited to 'doc/source/reference/c-api.array.rst')
-rw-r--r--doc/source/reference/c-api.array.rst16
1 files changed, 13 insertions, 3 deletions
diff --git a/doc/source/reference/c-api.array.rst b/doc/source/reference/c-api.array.rst
index 85edca909..155f1c3e5 100644
--- a/doc/source/reference/c-api.array.rst
+++ b/doc/source/reference/c-api.array.rst
@@ -1357,9 +1357,10 @@ Special functions for NPY_OBJECT
.. c:function:: int PyArray_SetWritebackIfCopyBase(PyArrayObject* arr, PyArrayObject* base)
Precondition: ``arr`` is a copy of ``base`` (though possibly with different
- strides, ordering, etc.) Sets the WRITEBACKIFCOPY flag and ``arr->base``, and
- set ``base`` to READONLY. Call PyArray_ResolveWritebackIfCopy before calling
- :c:func:`PyArray_DECREF`` in order copy any changes back to ``base`` and
+ strides, ordering, etc.) Sets the :c:data:`NPY_ARRAY_WRITEBACKIFCOPY` flag
+ and ``arr->base``, and set ``base`` to READONLY. Call
+ :c:func:`PyArray_ResolveWritebackIfCopy` before calling
+ `Py_DECREF`` in order copy any changes back to ``base`` and
reset the READONLY flag.
@@ -3251,6 +3252,15 @@ Memory management
:c:data:`NPY_USE_PYMEM` is 0, if :c:data:`NPY_USE_PYMEM` is 1, then
the Python memory allocator is used.
+.. c:function:: PyArray_ResolveWritebackIfCopy(PyArrayObject* obj)
+
+ If ``obj.flags`` has :c:data:`NPY_ARRAY_WRITEBACKIFCOPY` or (deprecated)
+ :c:data:`NPY_ARRAY_UPDATEIFCOPY`, this function copies ``obj->data`` to
+ `obj->base->data`, clears the flags, `DECREF` s `obj->base` and makes it
+ writeable, and sets ``obj->base`` to NULL. This is the opposite of
+ :c:func:`PyArray_SetWritebackIfCopyBase`. Usually this is called once
+ you are finished with ``obj``, just before ``Py_DECREF(obj)``. It may be called
+ multiple times, or with ``NULL`` input.
Threading support
^^^^^^^^^^^^^^^^^