diff options
author | kritisingh1 <kritisingh1.ks@gmail.com> | 2019-05-28 08:54:38 +0530 |
---|---|---|
committer | kritisingh1 <kritisingh1.ks@gmail.com> | 2019-05-31 07:12:29 +0530 |
commit | ef8bd3e88f33d85735ff6a209bcb25289a6025ce (patch) | |
tree | 488ee50c4810892242c9f922db83146fd99e6c63 /doc/source/reference/c-api.array.rst | |
parent | 3e3300ac119f9eb3f0afab2afd29b1816f965cad (diff) | |
download | numpy-ef8bd3e88f33d85735ff6a209bcb25289a6025ce.tar.gz |
DOC: Mention PyArray_GetField steals a reference
Diffstat (limited to 'doc/source/reference/c-api.array.rst')
-rw-r--r-- | doc/source/reference/c-api.array.rst | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/doc/source/reference/c-api.array.rst b/doc/source/reference/c-api.array.rst index aeb55ca03..de412a5d2 100644 --- a/doc/source/reference/c-api.array.rst +++ b/doc/source/reference/c-api.array.rst @@ -1671,11 +1671,13 @@ Conversion .. c:function:: PyObject* PyArray_GetField( \ PyArrayObject* self, PyArray_Descr* dtype, int offset) - Equivalent to :meth:`ndarray.getfield<numpy.ndarray.getfield>` (*self*, *dtype*, *offset*). Return - a new array of the given *dtype* using the data in the current - array at a specified *offset* in bytes. The *offset* plus the - itemsize of the new array type must be less than *self* - ->descr->elsize or an error is raised. The same shape and strides + Equivalent to :meth:`ndarray.getfield<numpy.ndarray.getfield>` + (*self*, *dtype*, *offset*). This function `steals a reference + <https://docs.python.org/3/c-api/intro.html?reference-count-details>`_ + to `PyArray_Descr` and returns a new array of the given `dtype` using + the data in the current array at a specified `offset` in bytes. The + `offset` plus the itemsize of the new array type must be less than ``self + ->descr->elsize`` or an error is raised. The same shape and strides as the original array are used. Therefore, this function has the effect of returning a field from a structured array. But, it can also be used to select specific bytes or groups of bytes from any array |