Skip to content

Commit 5914281

Browse files
authored
Merge pull request numpy#20195 from WarrenWeckesser/doc-misc
DOC: Two small changes in array.rst:
2 parents aebf386 + 50fc62c commit 5914281

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ User-defined data types
13221322
data-type object, *descr*, of the given *scalar* kind. Use
13231323
*scalar* = :c:data:`NPY_NOSCALAR` to register that an array of data-type
13241324
*descr* can be cast safely to a data-type whose type_number is
1325-
*totype*.
1325+
*totype*. The return value is 0 on success or -1 on failure.
13261326
13271327
.. c:function:: int PyArray_TypeNumFromName( \
13281328
char const *str)
@@ -2779,13 +2779,19 @@ Array Scalars
27792779
whenever 0-dimensional arrays could be returned to Python.
27802780
27812781
.. c:function:: PyObject* PyArray_Scalar( \
2782-
void* data, PyArray_Descr* dtype, PyObject* itemsize)
2783-
2784-
Return an array scalar object of the given enumerated *typenum*
2785-
and *itemsize* by **copying** from memory pointed to by *data*
2786-
. If *swap* is nonzero then this function will byteswap the data
2787-
if appropriate to the data-type because array scalars are always
2788-
in correct machine-byte order.
2782+
void* data, PyArray_Descr* dtype, PyObject* base)
2783+
2784+
Return an array scalar object of the given *dtype* by **copying**
2785+
from memory pointed to by *data*. *base* is expected to be the
2786+
array object that is the owner of the data. *base* is required
2787+
if `dtype` is a ``void`` scalar, or if the ``NPY_USE_GETITEM``
2788+
flag is set and it is known that the ``getitem`` method uses
2789+
the ``arr`` argument without checking if it is ``NULL``. Otherwise
2790+
`base` may be ``NULL``.
2791+
2792+
If the data is not in native byte order (as indicated by
2793+
``dtype->byteorder``) then this function will byteswap the data,
2794+
because array scalars are always in correct machine-byte order.
27892795
27902796
.. c:function:: PyObject* PyArray_ToScalar(void* data, PyArrayObject* arr)
27912797

0 commit comments

Comments
 (0)