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

Function PyFortranObject_NewAsAttr

numpy/f2py/src/fortranobject.c:182–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182PyObject *
183PyFortranObject_NewAsAttr(FortranDataDef *defs)
184{ /* used for calling F90 module routines */
185 PyFortranObject *fp = NULL;
186 fp = PyObject_New(PyFortranObject, &PyFortran_Type);
187 if (fp == NULL)
188 return NULL;
189 if ((fp->dict = PyDict_New()) == NULL) {
190 PyObject_Del(fp);
191 return NULL;
192 }
193 fp->len = 1;
194 fp->defs = defs;
195 if (defs->rank == -1) {
196 PyDict_SetItemString(fp->dict, "__name__", PyUnicode_FromFormat("function %s", defs->name));
197 } else if (defs->rank == 0) {
198 PyDict_SetItemString(fp->dict, "__name__", PyUnicode_FromFormat("scalar %s", defs->name));
199 } else {
200 PyDict_SetItemString(fp->dict, "__name__", PyUnicode_FromFormat("array %s", defs->name));
201 }
202 return (PyObject *)fp;
203}
204
205/* Fortran methods */
206

Callers 1

PyFortranObject_NewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected