* Checks if 'obj' is a valid output array for a ufunc, i.e. it is * either None or a writeable array, increments its reference count * and stores a pointer to it in 'store'. Returns 0 on success, sets * an exception and returns -1 on failure. */
| 845 | * an exception and returns -1 on failure. |
| 846 | */ |
| 847 | static int |
| 848 | _set_out_array(PyObject *obj, PyArrayObject **store) |
| 849 | { |
| 850 | if (obj == Py_None) { |
| 851 | /* Translate None to NULL */ |
| 852 | return 0; |
| 853 | } |
| 854 | if (PyArray_Check(obj)) { |
| 855 | /* If it's an array, store it */ |
| 856 | if (PyArray_FailUnlessWriteable((PyArrayObject *)obj, |
| 857 | "output array") < 0) { |
| 858 | return -1; |
| 859 | } |
| 860 | Py_INCREF(obj); |
| 861 | *store = (PyArrayObject *)obj; |
| 862 | |
| 863 | return 0; |
| 864 | } |
| 865 | PyErr_SetString(PyExc_TypeError, "return arrays must be of ArrayType"); |
| 866 | |
| 867 | return -1; |
| 868 | } |
| 869 | |
| 870 | /********* GENERIC UFUNC USING ITERATOR *********/ |
| 871 |
no test coverage detected