diff options
author | Guilherme Leobas <guilhermeleobas@gmail.com> | 2020-05-18 13:31:56 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-18 11:31:56 -0500 |
commit | 19efe2199845d1ba5464795eed89a347c70d22d8 (patch) | |
tree | dba348c7f55761c3f8dd98d071fc5c81686e224d /doc/source/reference/c-api | |
parent | 0eb532de60c9caaaa568ea294e7e1427265b6552 (diff) | |
download | numpy-19efe2199845d1ba5464795eed89a347c70d22d8.tar.gz |
DOC: Add PyArray_ContiguousFromObject C docs (gh-16207)
Add documentation for `PyArray_ContiguousFromObject` similar to the other
macros wrapping `PyArray_FromAny`
Fixes #16196
Diffstat (limited to 'doc/source/reference/c-api')
-rw-r--r-- | doc/source/reference/c-api/array.rst | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/doc/source/reference/c-api/array.rst b/doc/source/reference/c-api/array.rst index 56fc59da3..10c1704c2 100644 --- a/doc/source/reference/c-api/array.rst +++ b/doc/source/reference/c-api/array.rst @@ -251,7 +251,6 @@ From scratch .. versionadded:: 1.6 This function steals a reference to *descr* if it is not NULL. - This array creation routine allows for the convenient creation of a new array matching an existing array's shapes and memory layout, possibly changing the layout and/or data type. @@ -634,8 +633,17 @@ From other objects requirements set to :c:data:`NPY_ARRAY_DEFAULT` and the type_num member of the type argument set to *typenum*. -.. c:function:: PyObject *PyArray_FromObject( \ - PyObject *op, int typenum, int min_depth, int max_depth) +.. c:function:: PyObject* PyArray_ContiguousFromObject( \ + PyObject* op, int typenum, int min_depth, int max_depth) + + This function returns a well-behaved C-style contiguous array from any nested + sequence or array-interface exporting object. The minimum number of dimensions + the array can have is given by `min_depth` while the maximum is `max_depth`. + This is equivalent to call :c:func:`PyArray_FromAny` with requirements + :c:data:`NPY_ARRAY_DEFAULT` and :c:data:`NPY_ARRAY_ENSUREARRAY`. + +.. c:function:: PyObject* PyArray_FromObject( \ + PyObject* op, int typenum, int min_depth, int max_depth) Return an aligned and in native-byteorder array from any nested sequence or array-interface exporting object, op, of a type given by |