Py_INCREF(repoid);
args = PyTuple_New (3);
- PyTuple_SET_ITEM (args, 0, PyInt_FromLong (update_info->packages_seen));
- PyTuple_SET_ITEM (args, 1, PyInt_FromLong (update_info->count_from_md));
+ PyTuple_SET_ITEM (args, 0, PyLong_FromLong (update_info->packages_seen));
+ PyTuple_SET_ITEM (args, 1, PyLong_FromLong (update_info->count_from_md));
PyTuple_SET_ITEM (args, 2, repoid);
result = PyEval_CallObject (progress, args);
break;
}
- PyTuple_SET_ITEM (args, 0, PyInt_FromLong (level));
- PyTuple_SET_ITEM (args, 1, PyString_FromString (message));
+ PyTuple_SET_ITEM (args, 0, PyLong_FromLong (level));
+ PyTuple_SET_ITEM (args, 1, PyUnicode_FromString (message));
result = PyEval_CallObject (callback, args);
Py_DECREF (args);
g_log_remove_handler (NULL, log_id);
if (db_filename) {
- ret = PyString_FromString (db_filename);
+ ret = PyUnicode_FromString (db_filename);
g_free (db_filename);
} else {
PyErr_SetString (PyExc_TypeError, err->message);
{NULL, NULL, 0, NULL}
};
-PyMODINIT_FUNC
-init_sqlitecache (void)
+static struct PyModuleDef moduledef = {
+ PyModuleDef_HEAD_INIT,
+ "_sqlitecache", /* m_name */
+ NULL, /* m_doc */
+ 0, /* m_size */
+ SqliteMethods, /* m_methods */
+ NULL, /* m_reload */
+ NULL,
+ NULL,
+ NULL /* m_free */
+};
+
+PyObject * PyInit__sqlitecache(void);
+PyObject * PyInit__sqlitecache(void)
{
PyObject * m, * d;
- m = Py_InitModule ("_sqlitecache", SqliteMethods);
-
+ m = PyModule_Create (&moduledef);
+ if (m == NULL) {
+ return NULL;
+ }
d = PyModule_GetDict(m);
- PyDict_SetItemString(d, "DBVERSION", PyInt_FromLong(YUM_SQLITE_CACHE_DBVERSION));
+ PyDict_SetItemString(d, "DBVERSION", PyLong_FromLong(YUM_SQLITE_CACHE_DBVERSION));
+
+ return m;
}