| 318 | DEFINE_HELPER(ConvertInt64, int64, DT_INT64, ConvertOneInt64); |
| 319 | |
| 320 | const char* ConvertOneUint64(PyObject* v, uint64* out) { |
| 321 | #if PY_MAJOR_VERSION < 3 |
| 322 | if (TF_PREDICT_TRUE(PyInt_Check(v))) { |
| 323 | *out = PyInt_AsUnsignedLongLongMask(v); |
| 324 | return nullptr; |
| 325 | } |
| 326 | #endif |
| 327 | if (TF_PREDICT_TRUE(PyLong_Check(v) || IsPyDimension(v))) { |
| 328 | *out = PyLong_AsUnsignedLongLong(v); |
| 329 | return nullptr; |
| 330 | } |
| 331 | if (PyIsInstance(v, &PyIntegerArrType_Type)) { // NumPy integers |
| 332 | #if PY_MAJOR_VERSION < 3 |
| 333 | Safe_PyObjectPtr as_int = make_safe(PyNumber_Int(v)); |
| 334 | #else |
| 335 | Safe_PyObjectPtr as_int = make_safe(PyNumber_Long(v)); |
| 336 | #endif |
| 337 | return ConvertOneUint64(as_int.get(), out); |
| 338 | } |
| 339 | if (IsPyFloat(v)) return ErrorFoundFloat; |
| 340 | return ErrorMixedTypes; |
| 341 | } |
| 342 | |
| 343 | DEFINE_HELPER(ConvertUint64, uint64, DT_UINT64, ConvertOneUint64); |
| 344 |
nothing calls this directly
no test coverage detected