19 #if defined(PYPY_VERSION)
29 PyObject *
descr = _PyType_Lookup(type_obj, attr_name);
30 return bool((
descr !=
nullptr) && PyInstanceMethod_Check(
descr));
34 if (PyType_Check(obj)) {
37 PyTypeObject *type_obj = Py_TYPE(obj);
38 str attr_name(
"_pybind11_conduit_v1_");
39 bool assumed_to_be_callable =
false;
44 assumed_to_be_callable =
true;
46 PyObject *method = PyObject_GetAttr(obj, attr_name.
ptr());
47 if (method ==
nullptr) {
51 if (!assumed_to_be_callable && PyCallable_Check(method) == 0) {
55 return reinterpret_steal<object>(method);
59 const std::type_info *cpp_type_info) {
62 capsule cpp_type_info_capsule(
const_cast<void *
>(
static_cast<const void *
>(cpp_type_info)),
63 typeid(std::type_info).
name());
65 cpp_type_info_capsule,
66 bytes(
"raw_pointer_ephemeral"));
67 if (isinstance<capsule>(cpp_conduit)) {
68 return reinterpret_borrow<capsule>(cpp_conduit).get_pointer();
74 #define PYBIND11_HAS_CPP_CONDUIT 1