Skip to content

Commit 6df7113

Browse files
authored
Merge pull request numpy#19565 from cmarmo/temp-fix-beyond-basics
DOC: Fix sphinx warnings in c-info.beyond-basics.rst
2 parents 7e72cb9 + cee9c7c commit 6df7113

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

doc/source/reference/c-api/array.rst

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,16 @@ and its sub-types).
151151
152152
`numpy.ndarray.item` is identical to PyArray_GETITEM.
153153
154+
.. c:function:: int PyArray_FinalizeFunc(PyArrayObject* arr, PyObject* obj)
155+
156+
The function pointed to by the CObject
157+
:obj:`~numpy.class.__array_finalize__`.
158+
The first argument is the newly created sub-type. The second argument
159+
(if not NULL) is the "parent" array (if the array was created using
160+
slicing or some other operation where a clearly-distinguishable parent
161+
is present). This routine can do anything it wants to. It should
162+
return a -1 on error and 0 otherwise.
163+
154164
155165
Data access
156166
^^^^^^^^^^^
@@ -1250,8 +1260,8 @@ Converting data types
12501260
function returns :c:data:`NPY_FALSE`.
12511261
12521262
1253-
New data types
1254-
^^^^^^^^^^^^^^
1263+
User-defined data types
1264+
^^^^^^^^^^^^^^^^^^^^^^^
12551265
12561266
.. c:function:: void PyArray_InitArrFuncs(PyArray_ArrFuncs* f)
12571267
@@ -1295,6 +1305,13 @@ New data types
12951305
*descr* can be cast safely to a data-type whose type_number is
12961306
*totype*.
12971307
1308+
.. c:function:: int PyArray_TypeNumFromName( \
1309+
char const *str)
1310+
1311+
Given a string return the type-number for the data-type with that string as
1312+
the type-object name.
1313+
Returns ``NPY_NOTYPE`` without setting an error if no type can be found.
1314+
Only works for user-defined data-types.
12981315
12991316
Special functions for NPY_OBJECT
13001317
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

doc/source/user/c-info.beyond-basics.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ iterators so that all that needs to be done to advance to the next element in
172172
each array is for PyArray_ITER_NEXT to be called for each of the inputs. This
173173
incrementing is automatically performed by
174174
:c:func:`PyArray_MultiIter_NEXT` ( ``obj`` ) macro (which can handle a
175-
multiterator ``obj`` as either a :c:expr:`PyArrayMultiObject *` or a
175+
multiterator ``obj`` as either a :c:expr:`PyArrayMultiIterObject *` or a
176176
:c:expr:`PyObject *`). The data from input number ``i`` is available using
177177
:c:func:`PyArray_MultiIter_DATA` ( ``obj``, ``i`` ) and the total (broadcasted)
178178
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,
330330
scalarkind) should be used to specify that the data-type object
331331
from_descr can be cast to the data-type with type number
332332
totype_number. If you are not trying to alter scalar coercion rules,
333-
then use :c:data:`NPY_NOSCALAR` for the scalarkind argument.
333+
then use :c:enumerator:`NPY_NOSCALAR` for the scalarkind argument.
334334
335335
If you want to allow your new data-type to also be able to share in
336336
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
340340
can be cast to separately for each scalar kind that may be returned
341341
from your user-defined data-type. If you don't register scalar
342342
coercion handling, then all of your user-defined data-types will be
343-
seen as :c:data:`NPY_NOSCALAR`.
343+
seen as :c:enumerator:`NPY_NOSCALAR`.
344344
345345
346346
Registering a ufunc loop
@@ -473,7 +473,7 @@ The __array_finalize\__ method
473473
attribute is looked-up in the object dictionary. If it is present
474474
and not None, then it can be either a CObject containing a pointer
475475
to a :c:func:`PyArray_FinalizeFunc` or it can be a method taking a
476-
single argument (which could be None).
476+
single argument (which could be None)
477477
478478
If the :obj:`~numpy.class.__array_finalize__` attribute is a CObject, then the pointer
479479
must be a pointer to a function with the signature:

numpy/core/include/numpy/ndarraytypes.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,6 @@ typedef struct {
13081308
#define PyArray_MultiIter_NOTDONE(multi) \
13091309
(_PyMIT(multi)->index < _PyMIT(multi)->size)
13101310

1311-
13121311
/*
13131312
* Store the information needed for fancy-indexing over an array. The
13141313
* fields are slightly unordered to keep consec, dataptr and subspace

0 commit comments

Comments
 (0)