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

Function PyDecimal_Check

python/pyarrow/src/arrow/python/decimal.cc:206–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206bool PyDecimal_Check(PyObject* obj) {
207 static OwnedRef decimal_type;
208 if (!decimal_type.obj()) {
209 ARROW_CHECK_OK(ImportDecimalType(&decimal_type));
210 ARROW_DCHECK(PyType_Check(decimal_type.obj()));
211 }
212 // PyObject_IsInstance() is slower as it has to check for virtual subclasses
213 const int result =
214 PyType_IsSubtype(Py_TYPE(obj), reinterpret_cast<PyTypeObject*>(decimal_type.obj()));
215 ARROW_CHECK_NE(result, -1) << " error during PyType_IsSubtype check";
216 return result == 1;
217}
218
219bool PyDecimal_ISNAN(PyObject* obj) {
220 ARROW_DCHECK(PyDecimal_Check(obj)) << "obj is not an instance of decimal.Decimal";

Callers 4

PandasObjectIsNullFunction · 0.85
PyDecimal_ISNANFunction · 0.85
UpdateMethod · 0.85

Calls 1

ImportDecimalTypeFunction · 0.85

Tested by

no test coverage detected