Skip to content

Instantly share code, notes, and snippets.

@masahitojp
Created January 11, 2012 09:21
Show Gist options
  • Save masahitojp/1593878 to your computer and use it in GitHub Desktop.
Save masahitojp/1593878 to your computer and use it in GitHub Desktop.
/* pyuv.h */
#if PY_VERSION_HEX >= 0x03000000
#define PY3
#define PyInt_FromSsize_t PyLong_FromSsize_t
#define PyInt_FromLong PyLong_FromLong
/* pending start */
#define PyString_FromString PyBytes_FromString
#define PyString_AsString PyBytes_AsString
#define PyString_FromStringAndSize PyBytes_FromStringAndSize
#define PyString_Check PyBytes_Check
#define PyString_Size PyBytes_Size
/* PyDict_SetItemString ? */
/* pending end */
#endif
/* pyuv.c */
#ifdef PY3
/* pyuv_module */
static PyModuleDef pyuv_module = {
PyModuleDef_HEAD_INIT,
"pyuv", /*m_name*/
NULL, /*m_doc*/
-1, /*m_size*/
NULL, /*m_methods*/
};
#endif
/* Main module */
PyObject *pyuv;
#ifdef PY3
pyuv = PyModule_Create(&pyev_module);
#else
pyuv = Py_InitModule("pyuv", NULL);
#endif
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC
init_errno(void)
{
moduleinit();
}
#else
PyMODINIT_FUNC
PyInit__errno(void)
{
return moduleinit();
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment