Skip to content
Snippets Groups Projects
Commit 304bb4c3 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Python 3 compatibility

parent 18217a7c
No related branches found
No related tags found
No related merge requests found
......@@ -954,7 +954,7 @@ static PyObject* roc_for_far(PyObject*, PyObject* args, PyObject* kwds) {
}
static PyMethodDef library_methods[] = {
static PyMethodDef module_methods[] = {
{
s_epc_str,
(PyCFunction)epc,
......@@ -1072,10 +1072,30 @@ static PyMethodDef library_methods[] = {
{0} /* Sentinel */
};
PyDoc_STRVAR(module_docstr, "Bob metrics and performance figures");
#if PY_VERSION_HEX >= 0x03000000
static PyModuleDef module_definition = {
PyModuleDef_HEAD_INIT,
XBOB_EXT_MODULE_NAME,
module_docstr,
-1,
module_methods,
0, 0, 0, 0
};
#endif
PyMODINIT_FUNC XBOB_EXT_ENTRY_NAME (void) {
# if PY_VERSION_HEX >= 0x03000000
PyObject* m = PyModule_Create(&module_definition);
if (!m) return 0;
# else
PyObject* m = Py_InitModule3(XBOB_EXT_MODULE_NAME,
library_methods, "bob::measure bindings");
module_methods, module_docstr);
if (!m) return;
# endif
PyModule_AddStringConstant(m, "__version__", XBOB_EXT_MODULE_VERSION);
/* imports the NumPy C-API */
......@@ -1084,4 +1104,8 @@ PyMODINIT_FUNC XBOB_EXT_ENTRY_NAME (void) {
/* imports xbob.blitz C-API */
import_xbob_blitz();
# if PY_VERSION_HEX >= 0x03000000
return m;
# endif
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment