MCPcopy Create free account
hub / github.com/mhammond/pywin32 / CheckCallback

Method CheckCallback

isapi/src/PythonEng.cpp:230–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228
229
230bool CPythonHandler::CheckCallback(const char *cbname, PyObject **cb)
231{
232 if (*cb!=NULL)
233 return true; // already have the callback.
234
235 CEnterLeavePython celp;
236 if (!m_handler) {
237 PyErr_SetString(PyExc_RuntimeError, "The handler failed to load");
238 return false;
239 }
240 *cb = PyObject_GetAttrString(m_handler, (char *)cbname);
241 if (!*cb)
242 ExtensionError(NULL, "Failed to locate the callback");
243 return (*cb) != NULL;
244}
245
246// NOTE: Caller must setup and release thread-state - as we return a PyObject,
247// the caller must at least Py_DECREF it, so must hold the lock.

Callers

nothing calls this directly

Calls 1

ExtensionErrorFunction · 0.70

Tested by

no test coverage detected