NUMPY_API * * Useful to pass as converter function for O& processing in PyArgs_ParseTuple. * * This conversion function can be used with the "O&" argument for * PyArg_ParseTuple. It will immediately return an object of array type * or will convert to a NPY_ARRAY_CARRAY any other object. * * If you use PyArray_Converter, you must DECREF the array when finished * as you get a new reference
| 39 | * as you get a new reference to it. |
| 40 | */ |
| 41 | NPY_NO_EXPORT int |
| 42 | PyArray_Converter(PyObject *object, PyObject **address) |
| 43 | { |
| 44 | if (PyArray_Check(object)) { |
| 45 | *address = object; |
| 46 | Py_INCREF(object); |
| 47 | return NPY_SUCCEED; |
| 48 | } |
| 49 | else { |
| 50 | *address = PyArray_FROM_OF(object, NPY_ARRAY_CARRAY); |
| 51 | if (*address == NULL) { |
| 52 | return NPY_FAIL; |
| 53 | } |
| 54 | return NPY_SUCCEED; |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | /*NUMPY_API |
| 59 | * Useful to pass as converter function for O& processing in |
nothing calls this directly
no outgoing calls
no test coverage detected