summaryrefslogtreecommitdiff
path: root/doc/source/reference
diff options
context:
space:
mode:
Diffstat (limited to 'doc/source/reference')
-rw-r--r--doc/source/reference/c-api.array.rst22
-rw-r--r--doc/source/reference/c-api.dtype.rst2
2 files changed, 19 insertions, 5 deletions
diff --git a/doc/source/reference/c-api.array.rst b/doc/source/reference/c-api.array.rst
index 9265b1a97..d8c1dae97 100644
--- a/doc/source/reference/c-api.array.rst
+++ b/doc/source/reference/c-api.array.rst
@@ -202,7 +202,8 @@ From scratch
PyTypeObject* subtype, PyArray_Descr* descr, int nd, npy_intp* dims, \
npy_intp* strides, void* data, int flags, PyObject* obj)
- This function steals a reference to *descr*.
+ This function steals a reference to *descr*. The easiest way to get one
+ is using :c:func:`PyArray_DescrFromType`.
This is the main array creation function. Most new arrays are
created with this flexible function.
@@ -216,9 +217,11 @@ From scratch
:c:data:`&PyArray_Type<PyArray_Type>`, then *obj* is the object to pass to
the :obj:`~numpy.class.__array_finalize__` method of the subclass.
- If *data* is ``NULL``, then new memory will be allocated and *flags*
- can be non-zero to indicate a Fortran-style contiguous array. If
- *data* is not ``NULL``, then it is assumed to point to the memory
+ If *data* is ``NULL``, then new unitinialized memory will be allocated and
+ *flags* can be non-zero to indicate a Fortran-style contiguous array. Use
+ :c:ref:`PyArray_FILLWBYTE` to initialze the memory.
+
+ If *data* is not ``NULL``, then it is assumed to point to the memory
to be used for the array and the *flags* argument is used as the
new flags for the array (except the state of :c:data:`NPY_OWNDATA`,
:c:data:`NPY_ARRAY_WRITEBACKIFCOPY` and :c:data:`NPY_ARRAY_UPDATEIFCOPY`
@@ -232,6 +235,12 @@ From scratch
provided *dims* and *strides* are copied into newly allocated
dimension and strides arrays for the new array object.
+ :c:func:`PyArray_CheckStrides` can help verify non- ``NULL`` stride
+ information.
+
+ If ``data`` is provided, it must stay alive for the life of the array. One
+ way to manage this is through :c:func:`PyArray_SetBaseObject`
+
.. c:function:: PyObject* PyArray_NewLikeArray( \
PyArrayObject* prototype, NPY_ORDER order, PyArray_Descr* descr, \
int subok)
@@ -2849,7 +2858,10 @@ Data-type descriptors
Returns a data-type object corresponding to *typenum*. The
*typenum* can be one of the enumerated types, a character code for
- one of the enumerated types, or a user-defined type.
+ one of the enumerated types, or a user-defined type. If you want to use a
+ flexible size array, then you need to ``flexible typenum`` and set the
+ results ``elsize`` parameter to the desired size. The typenum is one of the
+ :c:data:`NPY_TYPES`.
.. c:function:: int PyArray_DescrConverter(PyObject* obj, PyArray_Descr** dtype)
diff --git a/doc/source/reference/c-api.dtype.rst b/doc/source/reference/c-api.dtype.rst
index 8af3a9080..9ac46b284 100644
--- a/doc/source/reference/c-api.dtype.rst
+++ b/doc/source/reference/c-api.dtype.rst
@@ -25,6 +25,8 @@ select the precision desired.
Enumerated Types
----------------
+.. c:var:: NPY_TYPES
+
There is a list of enumerated types defined providing the basic 24
data types plus some useful generic names. Whenever the code requires
a type number, one of these enumerated types is requested. The types