1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
| #include <Python.h>
PyDoc_STRVAR(BytertcSDKWrapper_example_doc, "example(obj, number)\ \ Example function");
PyObject *BytertcSDKWrapper_example(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject *obj = NULL; int number = 0;
static char* keywords[] = { "obj", "number", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Oi", keywords, &obj, &number)) { return NULL; }
if (number < 0) { PyErr_SetObject(PyExc_ValueError, obj); return NULL; }
Py_RETURN_NONE; }
static PyMethodDef BytertcSDKWrapper_functions[] = { { "example", (PyCFunction)BytertcSDKWrapper_example, METH_VARARGS | METH_KEYWORDS, BytertcSDKWrapper_example_doc }, { NULL, NULL, 0, NULL } };
int exec_BytertcSDKWrapper(PyObject *module) { PyModule_AddFunctions(module, BytertcSDKWrapper_functions);
PyModule_AddStringConstant(module, "__author__", "huzhiqin"); PyModule_AddStringConstant(module, "__version__", "1.0.0"); PyModule_AddIntConstant(module, "year", 2022);
return 0; }
PyDoc_STRVAR(BytertcSDKWrapper_doc, "The BytertcSDKWrapper module");
static PyModuleDef_Slot BytertcSDKWrapper_slots[] = { { Py_mod_exec, exec_BytertcSDKWrapper }, { 0, NULL } };
static PyModuleDef BytertcSDKWrapper_def = { PyModuleDef_HEAD_INIT, "BytertcSDKWrapper", BytertcSDKWrapper_doc, 0, NULL, BytertcSDKWrapper_slots, NULL, NULL, NULL, };
PyMODINIT_FUNC PyInit_BytertcSDKWrapper() { return PyModuleDef_Init(&BytertcSDKWrapper_def); }
|