diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2021-10-27 16:06:10 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-27 16:06:10 -0500 |
commit | 5914281547fc0fbd685e18e7147d5a33f604abe7 (patch) | |
tree | ebcc0a65e5cf8e3ad6d0634d93f6c033c7174ba3 /doc/source | |
parent | aebf38662647b328e5ac10c52a24202b3a22cf66 (diff) | |
parent | 50fc62cc73f1551cea6f3a1e1dd73e03d12065b8 (diff) | |
download | numpy-5914281547fc0fbd685e18e7147d5a33f604abe7.tar.gz |
Merge pull request #20195 from WarrenWeckesser/doc-misc
DOC: Two small changes in array.rst:
Diffstat (limited to 'doc/source')
-rw-r--r-- | doc/source/reference/c-api/array.rst | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/doc/source/reference/c-api/array.rst b/doc/source/reference/c-api/array.rst index 232690486..bb4405825 100644 --- a/doc/source/reference/c-api/array.rst +++ b/doc/source/reference/c-api/array.rst @@ -1322,7 +1322,7 @@ User-defined data types data-type object, *descr*, of the given *scalar* kind. Use *scalar* = :c:data:`NPY_NOSCALAR` to register that an array of data-type *descr* can be cast safely to a data-type whose type_number is - *totype*. + *totype*. The return value is 0 on success or -1 on failure. .. c:function:: int PyArray_TypeNumFromName( \ char const *str) @@ -2779,13 +2779,19 @@ Array Scalars whenever 0-dimensional arrays could be returned to Python. .. c:function:: PyObject* PyArray_Scalar( \ - void* data, PyArray_Descr* dtype, PyObject* itemsize) - - Return an array scalar object of the given enumerated *typenum* - and *itemsize* by **copying** from memory pointed to by *data* - . If *swap* is nonzero then this function will byteswap the data - if appropriate to the data-type because array scalars are always - in correct machine-byte order. + void* data, PyArray_Descr* dtype, PyObject* base) + + Return an array scalar object of the given *dtype* by **copying** + from memory pointed to by *data*. *base* is expected to be the + array object that is the owner of the data. *base* is required + if `dtype` is a ``void`` scalar, or if the ``NPY_USE_GETITEM`` + flag is set and it is known that the ``getitem`` method uses + the ``arr`` argument without checking if it is ``NULL``. Otherwise + `base` may be ``NULL``. + + If the data is not in native byte order (as indicated by + ``dtype->byteorder``) then this function will byteswap the data, + because array scalars are always in correct machine-byte order. .. c:function:: PyObject* PyArray_ToScalar(void* data, PyArrayObject* arr) |