#include "replace.h"
#include <tevent.h>
-#if PY_MAJOR_VERSION >= 3
#define PyLong_FromLong PyLong_FromLong
-#endif
/* discard signature of 'func' in favour of 'target_sig' */
#define PY_DISCARD_FUNC_SIG(target_sig, func) (target_sig)(void(*)(void))func
#define MODULE_DOC PyDoc_STR("Python wrapping of talloc-maintained objects.")
-#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
.m_name = "_tevent",
.m_size = -1,
.m_methods = tevent_methods,
};
-#endif
PyObject * module_init(void);
PyObject * module_init(void)
if (PyType_Ready(&TeventFd_Type) < 0)
return NULL;
-#if PY_MAJOR_VERSION >= 3
m = PyModule_Create(&moduledef);
-#else
- m = Py_InitModule3("_tevent", tevent_methods, MODULE_DOC);
-#endif
if (m == NULL)
return NULL;
return m;
}
-#if PY_MAJOR_VERSION >= 3
PyMODINIT_FUNC PyInit__tevent(void);
PyMODINIT_FUNC PyInit__tevent(void)
{
return module_init();
}
-#else
-void init_tevent(void);
-void init_tevent(void)
-{
- module_init();
-}
-#endif