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

Function f2py_rout_wrap_call

numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c:32–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30"Return objects:\n"
31" arr : array";
32static PyObject *f2py_rout_wrap_call(PyObject *capi_self,
33 PyObject *capi_args) {
34 PyObject * volatile capi_buildvalue = NULL;
35 int type_num = 0;
36 int elsize = 0;
37 npy_intp *dims = NULL;
38 PyObject *dims_capi = Py_None;
39 int rank = 0;
40 int intent = 0;
41 PyArrayObject *capi_arr_tmp = NULL;
42 PyObject *arr_capi = Py_None;
43 int i;
44
45 if (!PyArg_ParseTuple(capi_args,"iiOiO|:wrap.call",\
46 &type_num,&elsize,&dims_capi,&intent,&arr_capi))
47 return NULL;
48 rank = PySequence_Length(dims_capi);
49 dims = malloc(rank*sizeof(npy_intp));
50 for (i=0;i<rank;++i) {
51 PyObject *tmp;
52 tmp = PySequence_GetItem(dims_capi, i);
53 if (tmp == NULL) {
54 goto fail;
55 }
56 dims[i] = (npy_intp)PyLong_AsLong(tmp);
57 Py_DECREF(tmp);
58 if (dims[i] == -1 && PyErr_Occurred()) {
59 goto fail;
60 }
61 }
62 capi_arr_tmp = ndarray_from_pyobj(type_num,elsize,dims,rank,intent|F2PY_INTENT_OUT,arr_capi,"wrap.call failed");
63 if (capi_arr_tmp == NULL) {
64 free(dims);
65 return NULL;
66 }
67 capi_buildvalue = Py_BuildValue("N",capi_arr_tmp);
68 free(dims);
69 return capi_buildvalue;
70
71fail:
72 free(dims);
73 return NULL;
74}
75
76static char doc_f2py_rout_wrap_attrs[] = "\
77Function signature:\n\

Callers

nothing calls this directly

Calls 1

ndarray_from_pyobjFunction · 0.85

Tested by

no test coverage detected