MCPcopy Create free account
hub / github.com/wjakob/nanobind / from_python

Function from_python

tests/test_callbacks.cpp:44–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42 borrow<callable>((PyObject *) context)(arg);
43 }
44 bool from_python(handle src, uint8_t, cleanup_list*) noexcept {
45 if (!isinstance<callable>(src)) return false;
46 value = {(void *) src.ptr(), &wrap_call};
47 return true;
48 }
49 static handle from_cpp(callback cb, rv_policy policy, cleanup_list*) noexcept {
50 if (cb.func == &wrap_call)
51 return handle((PyObject *) cb.context).inc_ref();

Callers

nothing calls this directly

Calls 1

ptrMethod · 0.80

Tested by

no test coverage detected