summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/source/reference/c-api/array.rst21
-rw-r--r--doc/source/user/c-info.beyond-basics.rst8
-rw-r--r--numpy/core/include/numpy/ndarraytypes.h1
3 files changed, 23 insertions, 7 deletions
diff --git a/doc/source/reference/c-api/array.rst b/doc/source/reference/c-api/array.rst
index cb2f4b645..d943ba533 100644
--- a/doc/source/reference/c-api/array.rst
+++ b/doc/source/reference/c-api/array.rst
@@ -151,6 +151,16 @@ and its sub-types).
`numpy.ndarray.item` is identical to PyArray_GETITEM.
+.. c:function:: int PyArray_FinalizeFunc(PyArrayObject* arr, PyObject* obj)
+
+ The function pointed to by the CObject
+ :obj:`~numpy.class.__array_finalize__`.
+ The first argument is the newly created sub-type. The second argument
+ (if not NULL) is the "parent" array (if the array was created using
+ slicing or some other operation where a clearly-distinguishable parent
+ is present). This routine can do anything it wants to. It should
+ return a -1 on error and 0 otherwise.
+
Data access
^^^^^^^^^^^
@@ -1250,8 +1260,8 @@ Converting data types
function returns :c:data:`NPY_FALSE`.
-New data types
-^^^^^^^^^^^^^^
+User-defined data types
+^^^^^^^^^^^^^^^^^^^^^^^
.. c:function:: void PyArray_InitArrFuncs(PyArray_ArrFuncs* f)
@@ -1295,6 +1305,13 @@ New data types
*descr* can be cast safely to a data-type whose type_number is
*totype*.
+.. c:function:: int PyArray_TypeNumFromName( \
+ char const *str)
+
+ Given a string return the type-number for the data-type with that string as
+ the type-object name.
+ Returns ``NPY_NOTYPE`` without setting an error if no type can be found.
+ Only works for user-defined data-types.
Special functions for NPY_OBJECT
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/doc/source/user/c-info.beyond-basics.rst b/doc/source/user/c-info.beyond-basics.rst
index 289a7951b..121384d04 100644
--- a/doc/source/user/c-info.beyond-basics.rst
+++ b/doc/source/user/c-info.beyond-basics.rst
@@ -172,7 +172,7 @@ iterators so that all that needs to be done to advance to the next element in
each array is for PyArray_ITER_NEXT to be called for each of the inputs. This
incrementing is automatically performed by
:c:func:`PyArray_MultiIter_NEXT` ( ``obj`` ) macro (which can handle a
-multiterator ``obj`` as either a :c:expr:`PyArrayMultiObject *` or a
+multiterator ``obj`` as either a :c:expr:`PyArrayMultiIterObject *` or a
:c:expr:`PyObject *`). The data from input number ``i`` is available using
:c:func:`PyArray_MultiIter_DATA` ( ``obj``, ``i`` ) and the total (broadcasted)
size as :c:func:`PyArray_MultiIter_SIZE` ( ``obj``). An example of using this
@@ -330,7 +330,7 @@ function :c:func:`PyArray_RegisterCanCast` (from_descr, totype_number,
scalarkind) should be used to specify that the data-type object
from_descr can be cast to the data-type with type number
totype_number. If you are not trying to alter scalar coercion rules,
-then use :c:data:`NPY_NOSCALAR` for the scalarkind argument.
+then use :c:enumerator:`NPY_NOSCALAR` for the scalarkind argument.
If you want to allow your new data-type to also be able to share in
the scalar coercion rules, then you need to specify the scalarkind
@@ -340,7 +340,7 @@ available to that function). Then, you can register data-types that
can be cast to separately for each scalar kind that may be returned
from your user-defined data-type. If you don't register scalar
coercion handling, then all of your user-defined data-types will be
-seen as :c:data:`NPY_NOSCALAR`.
+seen as :c:enumerator:`NPY_NOSCALAR`.
Registering a ufunc loop
@@ -473,7 +473,7 @@ The __array_finalize\__ method
attribute is looked-up in the object dictionary. If it is present
and not None, then it can be either a CObject containing a pointer
to a :c:func:`PyArray_FinalizeFunc` or it can be a method taking a
- single argument (which could be None).
+ single argument (which could be None)
If the :obj:`~numpy.class.__array_finalize__` attribute is a CObject, then the pointer
must be a pointer to a function with the signature:
diff --git a/numpy/core/include/numpy/ndarraytypes.h b/numpy/core/include/numpy/ndarraytypes.h
index 3ea66b049..5acd24a7e 100644
--- a/numpy/core/include/numpy/ndarraytypes.h
+++ b/numpy/core/include/numpy/ndarraytypes.h
@@ -1308,7 +1308,6 @@ typedef struct {
#define PyArray_MultiIter_NOTDONE(multi) \
(_PyMIT(multi)->index < _PyMIT(multi)->size)
-
/*
* Store the information needed for fancy-indexing over an array. The
* fields are slightly unordered to keep consec, dataptr and subspace