mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'py3' of https://github.com/eli-schwartz/calibre
This commit is contained in:
commit
e3f51686ee
@ -263,6 +263,8 @@ sqlite_custom_init_funcs(PyObject *self, PyObject *args) {
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char sqlite_custom_doc[] = "Implementation of custom sqlite methods in C for speed.";
|
||||||
|
|
||||||
static PyMethodDef sqlite_custom_methods[] = {
|
static PyMethodDef sqlite_custom_methods[] = {
|
||||||
{"init_funcs", sqlite_custom_init_funcs, METH_VARARGS,
|
{"init_funcs", sqlite_custom_init_funcs, METH_VARARGS,
|
||||||
"init_funcs()\n\nInitialize module."
|
"init_funcs()\n\nInitialize module."
|
||||||
@ -271,11 +273,33 @@ static PyMethodDef sqlite_custom_methods[] = {
|
|||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
CALIBRE_MODINIT_FUNC
|
#if PY_MAJOR_VERSION >= 3
|
||||||
initsqlite_custom(void) {
|
#define INITERROR return NULL
|
||||||
|
#define INITMODULE PyModule_Create(&sqlite_custom_module)
|
||||||
|
static struct PyModuleDef sqlite_custom_module = {
|
||||||
|
/* m_base */ PyModuleDef_HEAD_INIT,
|
||||||
|
/* m_name */ "sqlite_custom",
|
||||||
|
/* m_doc */ sqlite_custom_doc,
|
||||||
|
/* m_size */ -1,
|
||||||
|
/* m_methods */ sqlite_custom_methods,
|
||||||
|
/* m_slots */ 0,
|
||||||
|
/* m_traverse */ 0,
|
||||||
|
/* m_clear */ 0,
|
||||||
|
/* m_free */ 0,
|
||||||
|
};
|
||||||
|
CALIBRE_MODINIT_FUNC PyInit_sqlite_custom(void) {
|
||||||
|
#else
|
||||||
|
#define INITERROR return
|
||||||
|
#define INITMODULE Py_InitModule3("sqlite_custom", sqlite_custom_methods, sqlite_custom_doc)
|
||||||
|
CALIBRE_MODINIT_FUNC initsqlite_custom(void) {
|
||||||
|
#endif
|
||||||
|
|
||||||
PyObject *m;
|
PyObject *m;
|
||||||
m = Py_InitModule3("sqlite_custom", sqlite_custom_methods,
|
m = INITMODULE;
|
||||||
"Implementation of custom sqlite methods in C for speed."
|
if (m == NULL) {
|
||||||
);
|
INITERROR;
|
||||||
if (m == NULL) return;
|
}
|
||||||
|
#if PY_MAJOR_VERSION >= 3
|
||||||
|
return m;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user