MCPcopy Create free account
hub / github.com/apache/arrow / MayHaveNaN

Function MayHaveNaN

python/pyarrow/src/arrow/python/helpers.cc:283–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281template Status CIntFromPython(PyObject*, uint64_t*, const std::string&);
282
283inline bool MayHaveNaN(PyObject* obj) {
284 // Some core types can be very quickly type-checked and do not allow NaN values
285 const int64_t non_nan_tpflags = Py_TPFLAGS_LONG_SUBCLASS | Py_TPFLAGS_LIST_SUBCLASS |
286 Py_TPFLAGS_TUPLE_SUBCLASS | Py_TPFLAGS_BYTES_SUBCLASS |
287 Py_TPFLAGS_UNICODE_SUBCLASS | Py_TPFLAGS_DICT_SUBCLASS |
288 Py_TPFLAGS_BASE_EXC_SUBCLASS | Py_TPFLAGS_TYPE_SUBCLASS;
289 return !PyType_HasFeature(Py_TYPE(obj), non_nan_tpflags);
290}
291
292bool PyFloat_IsNaN(PyObject* obj) {
293 return PyFloat_Check(obj) && std::isnan(PyFloat_AsDouble(obj));

Callers 1

PandasObjectIsNullFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected