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

Function npy_to_bool

numpy/core/src/multiarray/textreading/conversions.c:21–32  ·  view source on GitHub ↗

* Coercion to boolean is done via integer right now. */

Source from the content-addressed store, hash-verified

19 * Coercion to boolean is done via integer right now.
20 */
21NPY_NO_EXPORT int
22npy_to_bool(PyArray_Descr *NPY_UNUSED(descr),
23 const Py_UCS4 *str, const Py_UCS4 *end, char *dataptr,
24 parser_config *NPY_UNUSED(pconfig))
25{
26 int64_t res;
27 if (str_to_int64(str, end, INT64_MIN, INT64_MAX, &res) < 0) {
28 return -1;
29 }
30 *dataptr = (char)(res != 0);
31 return 0;
32}
33
34
35/*

Callers

nothing calls this directly

Calls 1

str_to_int64Function · 0.85

Tested by

no test coverage detected