MCPcopy Create free account
hub / github.com/numpy/numpy / PyArray_NewCopy

Function PyArray_NewCopy

numpy/core/src/multiarray/convert.c:475–497  ·  view source on GitHub ↗

NUMPY_API * Copy an array. */

Source from the content-addressed store, hash-verified

473 * Copy an array.
474 */
475NPY_NO_EXPORT PyObject *
476PyArray_NewCopy(PyArrayObject *obj, NPY_ORDER order)
477{
478 PyArrayObject *ret;
479
480 if (obj == NULL) {
481 PyErr_SetString(PyExc_ValueError,
482 "obj is NULL in PyArray_NewCopy");
483 return NULL;
484 }
485
486 ret = (PyArrayObject *)PyArray_NewLikeArray(obj, order, NULL, 1);
487 if (ret == NULL) {
488 return NULL;
489 }
490
491 if (PyArray_AssignArray(ret, obj, NULL, NPY_UNSAFE_CASTING) < 0) {
492 Py_DECREF(ret);
493 return NULL;
494 }
495
496 return (PyObject *)ret;
497}
498
499/*NUMPY_API
500 * View

Callers 11

PyArray_ByteswapFunction · 0.85
array_copyFunction · 0.85
array_copy_keeporderFunction · 0.85
array_deepcopyFunction · 0.85
PyArray_CheckFromAny_intFunction · 0.85
PyArray_NewshapeFunction · 0.85
PyArray_CopyAndTransposeFunction · 0.85
array_subscriptFunction · 0.85
cblas_matrixproductFunction · 0.85

Calls 2

PyArray_NewLikeArrayFunction · 0.85
PyArray_AssignArrayFunction · 0.85

Tested by

no test coverage detected