| 255 | } |
| 256 | |
| 257 | bool is_bool_list(PyObject* arg) { |
| 258 | if (!PyList_Check(arg)) { |
| 259 | return false; |
| 260 | } |
| 261 | size_t sz = PyList_Size(arg); |
| 262 | if (!sz) { |
| 263 | return false; |
| 264 | } |
| 265 | for (size_t i = 0; i < sz; ++i) { |
| 266 | PyObject* handle = PyList_GetItem(arg, i); |
| 267 | if (!PyBool_Check(handle)) { |
| 268 | return false; |
| 269 | } |
| 270 | } |
| 271 | return true; |
| 272 | } |
| 273 | |
| 274 | bool is_bool_dtype(PyObject* args) { |
| 275 | if (!PyObject_HasAttrString(args, "dtype")) |