Commit 2838af4b authored by Manuel Günther's avatar Manuel Günther

Replaced mal-functioning PyArray_IsAnyScalar with novel PyBob_NumberCheck.

parent c3dc3c25
......@@ -7,6 +7,7 @@
#include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h>
#include <bob.extension/defines.h>
#include "types.h"
PyDoc_STRVAR(s_ceps_str, BOB_EXT_MODULE_PREFIX ".Ceps");
......@@ -278,7 +279,7 @@ static PyObject* PyBobApCeps_GetNCeps
static int PyBobApCeps_SetNCeps
(PyBobApCepsObject* self, PyObject* o, void* /*closure*/) {
if (!PyArray_IsAnyScalar(o)) {
if (!PyBob_NumberCheck(o)) {
PyErr_Format(PyExc_TypeError, "`%s' n_ceps can only be set using a number, not `%s'", Py_TYPE(self)->tp_name, Py_TYPE(o)->tp_name);
return -1;
}
......@@ -316,7 +317,7 @@ static PyObject* PyBobApCeps_GetDeltaWin
static int PyBobApCeps_SetDeltaWin
(PyBobApCepsObject* self, PyObject* o, void* /*closure*/) {
if (!PyArray_IsAnyScalar(o)) {
if (!PyBob_NumberCheck(o)) {
PyErr_Format(PyExc_TypeError, "`%s' delta_win can only be set using a number, not `%s'", Py_TYPE(self)->tp_name, Py_TYPE(o)->tp_name);
return -1;
}
......
......@@ -7,6 +7,7 @@
#include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h>
#include <bob.extension/defines.h>
#include "types.h"
PyDoc_STRVAR(s_energy_str, BOB_EXT_MODULE_PREFIX ".Energy");
......@@ -217,7 +218,7 @@ static PyObject* PyBobApEnergy_GetEnergyFloor
static int PyBobApEnergy_SetEnergyFloor
(PyBobApEnergyObject* self, PyObject* o, void* /*closure*/) {
if (!PyArray_IsAnyScalar(o)) {
if (!PyBob_NumberCheck(o)) {
PyErr_Format(PyExc_TypeError, "`%s' energy floor can only be set using a number, not `%s'", Py_TYPE(self)->tp_name, Py_TYPE(o)->tp_name);
return -1;
}
......
......@@ -7,6 +7,7 @@
#include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h>
#include <bob.extension/defines.h>
#include "types.h"
PyDoc_STRVAR(s_frame_extractor_str, BOB_EXT_MODULE_PREFIX ".FrameExtractor");
......@@ -219,7 +220,7 @@ static PyObject* PyBobApFrameExtractor_GetSamplingFrequency
static int PyBobApFrameExtractor_SetSamplingFrequency
(PyBobApFrameExtractorObject* self, PyObject* o, void* /*closure*/) {
if (!PyArray_IsAnyScalar(o)) {
if (!PyBob_NumberCheck(o)) {
PyErr_Format(PyExc_TypeError, "`%s' sampling frequency can only be set using a number, not `%s'", Py_TYPE(self)->tp_name, Py_TYPE(o)->tp_name);
return -1;
}
......@@ -256,7 +257,7 @@ static PyObject* PyBobApFrameExtractor_GetWinLengthMs
static int PyBobApFrameExtractor_SetWinLengthMs
(PyBobApFrameExtractorObject* self, PyObject* o, void* /*closure*/) {
if (!PyArray_IsAnyScalar(o)) {
if (!PyBob_NumberCheck(o)) {
PyErr_Format(PyExc_TypeError, "`%s' windows length can only be set using a number, not `%s'", Py_TYPE(self)->tp_name, Py_TYPE(o)->tp_name);
return -1;
}
......@@ -293,7 +294,7 @@ static PyObject* PyBobApFrameExtractor_GetWinShiftMs
static int PyBobApFrameExtractor_SetWinShiftMs
(PyBobApFrameExtractorObject* self, PyObject* o, void* /*closure*/) {
if (!PyArray_IsAnyScalar(o)) {
if (!PyBob_NumberCheck(o)) {
PyErr_Format(PyExc_TypeError, "`%s' windows shift can only be set using a number, not `%s'", Py_TYPE(self)->tp_name, Py_TYPE(o)->tp_name);
return -1;
}
......
......@@ -7,6 +7,7 @@
#include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h>
#include <bob.extension/defines.h>
#include "types.h"
PyDoc_STRVAR(s_spectrogram_str, BOB_EXT_MODULE_PREFIX ".Spectrogram");
......@@ -254,7 +255,7 @@ static PyObject* PyBobApSpectrogram_GetNFilters
static int PyBobApSpectrogram_SetNFilters
(PyBobApSpectrogramObject* self, PyObject* o, void* /*closure*/) {
if (!PyArray_IsAnyScalar(o)) {
if (!PyBob_NumberCheck(o)) {
PyErr_Format(PyExc_TypeError, "`%s' n_filters can only be set using a number, not `%s'", Py_TYPE(self)->tp_name, Py_TYPE(o)->tp_name);
return -1;
}
......@@ -291,7 +292,7 @@ static PyObject* PyBobApSpectrogram_GetFMin
static int PyBobApSpectrogram_SetFMin
(PyBobApSpectrogramObject* self, PyObject* o, void* /*closure*/) {
if (!PyArray_IsAnyScalar(o)) {
if (!PyBob_NumberCheck(o)) {
PyErr_Format(PyExc_TypeError, "`%s' f_min can only be set using a number, not `%s'", Py_TYPE(self)->tp_name, Py_TYPE(o)->tp_name);
return -1;
}
......@@ -328,7 +329,7 @@ static PyObject* PyBobApSpectrogram_GetFMax
static int PyBobApSpectrogram_SetFMax
(PyBobApSpectrogramObject* self, PyObject* o, void* /*closure*/) {
if (!PyArray_IsAnyScalar(o)) {
if (!PyBob_NumberCheck(o)) {
PyErr_Format(PyExc_TypeError, "`%s' f_max can only be set using a number, not `%s'", Py_TYPE(self)->tp_name, Py_TYPE(o)->tp_name);
return -1;
}
......@@ -365,7 +366,7 @@ static PyObject* PyBobApSpectrogram_GetPreEmphasisCoeff
static int PyBobApSpectrogram_SetPreEmphasisCoeff
(PyBobApSpectrogramObject* self, PyObject* o, void* /*closure*/) {
if (!PyArray_IsAnyScalar(o)) {
if (!PyBob_NumberCheck(o)) {
PyErr_Format(PyExc_TypeError, "`%s' pre_emphasis_coeff can only be set using a number, not `%s'", Py_TYPE(self)->tp_name, Py_TYPE(o)->tp_name);
return -1;
}
......
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