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

Function MayHaveNaN

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

Source from the content-addressed store, hash-verified

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

Callers 1

PandasObjectIsNullFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected