48namespace lass::python::impl
52LASS_EXECUTE_BEFORE_MAIN_EX(Function_executeBeforeMain,
53 PyCallback::_lassPyClassDef.setSlot(Py_tp_call, &PyCallback::_tp_call);
56PyCallback::PyCallback(TPimpl pimpl)
58 impl::initLassModule();
59 impl::fixObjectType(
this);
60 pimpl_ = std::move(pimpl);
63PyObject* PyCallback::_tp_call(PyObject* self, PyObject* args, PyObject* kwargs)
65 if (!PyType_IsSubtype(self->ob_type, PyCallback::_lassPyClassDef.type()))
67 PyErr_SetString(PyExc_TypeError,
"Not a _lass.PyCallback");
72 if (!PyDict_CheckExact(kwargs))
74 PyErr_BadInternalCall();
77 if (PyDict_Size(kwargs) != 0)
79 PyErr_SetString(PyExc_TypeError,
"function takes no keyword arguments");
83 return static_cast<PyCallback*
>(self)->pimpl_->call(args);
#define PY_DECLARE_CLASS(i_cppClass)
Declare a Python class with automatic name and no documentation.