Commit f373fb5c authored by Manuel Günther's avatar Manuel Günther

Replaced Py_INCREF with Py_BuildValue as far as possible

parent 627a7918
......@@ -587,8 +587,7 @@ static PyObject* PyBobApCeps_Call
return 0;
}
Py_INCREF(output);
return PyBlitzArray_NUMPY_WRAP(reinterpret_cast<PyObject*>(output));
return PyBlitzArray_NUMPY_WRAP(Py_BuildValue("O", output));
}
......
......@@ -318,8 +318,7 @@ static PyObject* PyBobApEnergy_Call
return 0;
}
Py_INCREF(output);
return PyBlitzArray_NUMPY_WRAP(reinterpret_cast<PyObject*>(output));
return PyBlitzArray_NUMPY_WRAP(Py_BuildValue("O", output));
}
......
......@@ -74,8 +74,7 @@ static PyObject* create_module (void) {
return 0;
}
Py_INCREF(m);
return m;
return Py_BuildValue("O", m);
}
......
......@@ -651,8 +651,7 @@ static PyObject* PyBobApSpectrogram_Call
return 0;
}
Py_INCREF(output);
return PyBlitzArray_NUMPY_WRAP(reinterpret_cast<PyObject*>(output));
return PyBlitzArray_NUMPY_WRAP(Py_BuildValue("O", output));
}
......
......@@ -22,15 +22,6 @@
#include <bob.core/config.h>
#include <bob.sp/config.h>
static int dict_set(PyObject* d, const char* key, const char* value) {
PyObject* v = Py_BuildValue("s", value);
if (!v) return 0;
int retval = PyDict_SetItemString(d, key, v);
Py_DECREF(v);
if (retval == 0) return 1; //all good
return 0; //a problem occurred
}
static int dict_steal(PyObject* d, const char* key, PyObject* value) {
if (!value) return 0;
int retval = PyDict_SetItemString(d, key, value);
......@@ -39,6 +30,12 @@ static int dict_steal(PyObject* d, const char* key, PyObject* value) {
return 0; //a problem occurred
}
static int dict_set(PyObject* d, const char* key, const char* value) {
PyObject* v = Py_BuildValue("s", value);
return dict_steal(d, key, v);
}
/**
* Describes the version of Boost libraries installed
*/
......@@ -167,8 +164,7 @@ static PyObject* create_module (void) {
if (import_bob_blitz() < 0) return 0;
Py_INCREF(m);
return m;
return Py_BuildValue("O", m);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment