* Calls arr_of_subclass.__array_wrap__(towrap), in order to make 'towrap' * have the same ndarray subclass as 'arr_of_subclass'. */
| 4044 | * have the same ndarray subclass as 'arr_of_subclass'. |
| 4045 | */ |
| 4046 | NPY_NO_EXPORT PyArrayObject * |
| 4047 | PyArray_SubclassWrap(PyArrayObject *arr_of_subclass, PyArrayObject *towrap) |
| 4048 | { |
| 4049 | PyObject *wrapped = PyObject_CallMethodObjArgs((PyObject *)arr_of_subclass, |
| 4050 | npy_ma_str_array_wrap, (PyObject *)towrap, NULL); |
| 4051 | if (wrapped == NULL) { |
| 4052 | return NULL; |
| 4053 | } |
| 4054 | if (!PyArray_Check(wrapped)) { |
| 4055 | PyErr_SetString(PyExc_RuntimeError, |
| 4056 | "ndarray subclass __array_wrap__ method returned an " |
| 4057 | "object which was not an instance of an ndarray subclass"); |
| 4058 | Py_DECREF(wrapped); |
| 4059 | return NULL; |
| 4060 | } |
| 4061 | |
| 4062 | return (PyArrayObject *)wrapped; |
| 4063 | } |
no outgoing calls
no test coverage detected