From 543fbadf587061f8084cdd407b0c587573054014 Mon Sep 17 00:00:00 2001 From: Manuel Guenther <manuel.guenther@idiap.ch> Date: Thu, 26 Feb 2015 19:32:18 +0100 Subject: [PATCH] Replaced mal-functioning PyNumber_Check with the novel PyBob_NumberCheck. --- bob/learn/activation/activation.cpp | 15 +++++++-------- requirements.txt | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/bob/learn/activation/activation.cpp b/bob/learn/activation/activation.cpp index 2591e12..65bef28 100644 --- a/bob/learn/activation/activation.cpp +++ b/bob/learn/activation/activation.cpp @@ -8,10 +8,11 @@ */ #define BOB_LEARN_ACTIVATION_MODULE -#include <bob.learn.activation/api.h> -#include <bob.io.base/api.h> #include <bob.blitz/cppapi.h> #include <bob.blitz/cleanup.h> +#include <bob.extension/defines.h> +#include <bob.learn.activation/api.h> +#include <bob.io.base/api.h> #include <bob.learn.activation/Activation.h> #include <boost/bind.hpp> #include <boost/function.hpp> @@ -63,7 +64,7 @@ PyObject* PyBobLearnActivation_NewFromActivation retval->cxx = a; - return reinterpret_cast<PyObject*>(retval); + return Py_BuildValue("N", retval); } @@ -174,12 +175,11 @@ static PyObject* PyBobLearnActivation_call1(PyBobLearnActivationObject* self, return 0; } - Py_INCREF(res); - return PyBlitzArray_NUMPY_WRAP(res); + return PyBlitzArray_NUMPY_WRAP(Py_BuildValue("O", res)); } - else if (PyNumber_Check(z)) { + else if (PyBob_NumberCheck(z)) { PyObject* z_float = PyNumber_Float(z); auto z_float_ = make_safe(z_float); @@ -251,8 +251,7 @@ static PyObject* PyBobLearnActivation_call2(PyBobLearnActivationObject* self, return 0; } - Py_INCREF(res); - return PyBlitzArray_NUMPY_WRAP(reinterpret_cast<PyObject*>(res)); + return PyBlitzArray_NUMPY_WRAP(Py_BuildValue("O", res)); } diff --git a/requirements.txt b/requirements.txt index 6d514b1..ac803d0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ setuptools -bob.extension +bob.extension>2.0.4 bob.blitz bob.core bob.io.base -- GitLab