| 228 | |
| 229 | |
| 230 | bool 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. |
nothing calls this directly
no test coverage detected