#define PY_SSIZE_T_CLEAN #include #include #include "Extension.h" #include "Extension2.h" PyModuleDef examplemodule = { PyModuleDef_HEAD_INIT, .m_name = "example", .m_doc = "Example module", .m_size = -1, }; PyMODINIT_FUNC PyInit_example(void) { PyObject* m; if ((PyType_Ready(&ExampleType) < 0) || (PyType_Ready(&CustomType) < 0)) return NULL; m = PyModule_Create(&examplemodule); if (m == NULL) return NULL; Py_INCREF(&ExampleType); if (PyModule_AddObject(m, "Example", (PyObject*)&ExampleType) < 0) { Py_DECREF(&ExampleType); Py_DECREF(m); return NULL; } Py_INCREF(&CustomType); if (PyModule_AddObject(m, "Custom", (PyObject*)&CustomType) < 0) { Py_DECREF(&CustomType); Py_DECREF(m); return NULL; } return m; }