NUMPY_API * Cast Scalar to c-type */
| 209 | * Cast Scalar to c-type |
| 210 | */ |
| 211 | NPY_NO_EXPORT int |
| 212 | PyArray_CastScalarDirect(PyObject *scalar, PyArray_Descr *indescr, |
| 213 | void *ctypeptr, int outtype) |
| 214 | { |
| 215 | PyArray_VectorUnaryFunc* castfunc; |
| 216 | void *ptr; |
| 217 | castfunc = PyArray_GetCastFunc(indescr, outtype); |
| 218 | if (castfunc == NULL) { |
| 219 | return -1; |
| 220 | } |
| 221 | ptr = scalar_value(scalar, indescr); |
| 222 | castfunc(ptr, ctypeptr, 1, NULL, NULL); |
| 223 | return 0; |
| 224 | } |
| 225 | |
| 226 | /*NUMPY_API |
| 227 | * Get 0-dim array from scalar |
nothing calls this directly
no test coverage detected