MCPcopy Create free account
hub / github.com/bab2min/tomotopy / checkType

Function checkType

src/python/handler/PyUtils.h:3416–3429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3414
3415 template<class Ty>
3416 Ty* checkType(PyObject* obj, const char* errorMsg = nullptr)
3417 {
3418 auto* ptr = py::TypeWrapper<Ty>::obj;
3419 if (!ptr)
3420 {
3421 throw TypeError{ "type not found in module" };
3422 }
3423 if (!PyObject_TypeCheck(obj, ptr))
3424 {
3425 if (errorMsg) throw TypeError{ errorMsg };
3426 else return nullptr;
3427 }
3428 return (Ty*)obj;
3429 }
3430
3431 template<class Ty>
3432 py::UniqueCObj<Ty> checkType(py::UniqueObj obj, const char* errorMsg = nullptr)

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected