| 204 | } |
| 205 | |
| 206 | bool 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 | |
| 219 | bool PyDecimal_ISNAN(PyObject* obj) { |
| 220 | ARROW_DCHECK(PyDecimal_Check(obj)) << "obj is not an instance of decimal.Decimal"; |
no test coverage detected