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

Function array_real_set

numpy/core/src/multiarray/getset.c:752–783  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

750
751
752static int
753array_real_set(PyArrayObject *self, PyObject *val, void *NPY_UNUSED(ignored))
754{
755 PyArrayObject *ret;
756 PyArrayObject *new;
757 int retcode;
758
759 if (val == NULL) {
760 PyErr_SetString(PyExc_AttributeError,
761 "Cannot delete array real part");
762 return -1;
763 }
764 if (PyArray_ISCOMPLEX(self)) {
765 ret = _get_part(self, 0);
766 if (ret == NULL) {
767 return -1;
768 }
769 }
770 else {
771 Py_INCREF(self);
772 ret = self;
773 }
774 new = (PyArrayObject *)PyArray_FROM_O(val);
775 if (new == NULL) {
776 Py_DECREF(ret);
777 return -1;
778 }
779 retcode = PyArray_MoveInto(ret, new);
780 Py_DECREF(ret);
781 Py_DECREF(new);
782 return retcode;
783}
784
785/* For Object arrays we need to get
786 and set the imaginary part of

Callers

nothing calls this directly

Calls 2

_get_partFunction · 0.85
PyArray_MoveIntoFunction · 0.85

Tested by

no test coverage detected