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 @@ ...@@ -7,6 +7,7 @@
#include <bob.blitz/cppapi.h> #include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h> #include <bob.blitz/cleanup.h>
#include <bob.extension/defines.h>
#include "types.h" #include "types.h"
PyDoc_STRVAR(s_ceps_str, BOB_EXT_MODULE_PREFIX ".Ceps"); PyDoc_STRVAR(s_ceps_str, BOB_EXT_MODULE_PREFIX ".Ceps");
...@@ -278,7 +279,7 @@ static PyObject* PyBobApCeps_GetNCeps ...@@ -278,7 +279,7 @@ static PyObject* PyBobApCeps_GetNCeps
static int PyBobApCeps_SetNCeps static int PyBobApCeps_SetNCeps
(PyBobApCepsObject* self, PyObject* o, void* /*closure*/) { (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); 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; return -1;
} }
...@@ -316,7 +317,7 @@ static PyObject* PyBobApCeps_GetDeltaWin ...@@ -316,7 +317,7 @@ static PyObject* PyBobApCeps_GetDeltaWin
static int PyBobApCeps_SetDeltaWin static int PyBobApCeps_SetDeltaWin
(PyBobApCepsObject* self, PyObject* o, void* /*closure*/) { (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); 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; return -1;
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <bob.blitz/cppapi.h> #include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h> #include <bob.blitz/cleanup.h>
#include <bob.extension/defines.h>
#include "types.h" #include "types.h"
PyDoc_STRVAR(s_energy_str, BOB_EXT_MODULE_PREFIX ".Energy"); PyDoc_STRVAR(s_energy_str, BOB_EXT_MODULE_PREFIX ".Energy");
...@@ -217,7 +218,7 @@ static PyObject* PyBobApEnergy_GetEnergyFloor ...@@ -217,7 +218,7 @@ static PyObject* PyBobApEnergy_GetEnergyFloor
static int PyBobApEnergy_SetEnergyFloor static int PyBobApEnergy_SetEnergyFloor
(PyBobApEnergyObject* self, PyObject* o, void* /*closure*/) { (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); 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; return -1;
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <bob.blitz/cppapi.h> #include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h> #include <bob.blitz/cleanup.h>
#include <bob.extension/defines.h>
#include "types.h" #include "types.h"
PyDoc_STRVAR(s_frame_extractor_str, BOB_EXT_MODULE_PREFIX ".FrameExtractor"); PyDoc_STRVAR(s_frame_extractor_str, BOB_EXT_MODULE_PREFIX ".FrameExtractor");
...@@ -219,7 +220,7 @@ static PyObject* PyBobApFrameExtractor_GetSamplingFrequency ...@@ -219,7 +220,7 @@ static PyObject* PyBobApFrameExtractor_GetSamplingFrequency
static int PyBobApFrameExtractor_SetSamplingFrequency static int PyBobApFrameExtractor_SetSamplingFrequency
(PyBobApFrameExtractorObject* self, PyObject* o, void* /*closure*/) { (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); 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; return -1;
} }
...@@ -256,7 +257,7 @@ static PyObject* PyBobApFrameExtractor_GetWinLengthMs ...@@ -256,7 +257,7 @@ static PyObject* PyBobApFrameExtractor_GetWinLengthMs
static int PyBobApFrameExtractor_SetWinLengthMs static int PyBobApFrameExtractor_SetWinLengthMs
(PyBobApFrameExtractorObject* self, PyObject* o, void* /*closure*/) { (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); 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; return -1;
} }
...@@ -293,7 +294,7 @@ static PyObject* PyBobApFrameExtractor_GetWinShiftMs ...@@ -293,7 +294,7 @@ static PyObject* PyBobApFrameExtractor_GetWinShiftMs
static int PyBobApFrameExtractor_SetWinShiftMs static int PyBobApFrameExtractor_SetWinShiftMs
(PyBobApFrameExtractorObject* self, PyObject* o, void* /*closure*/) { (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); 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; return -1;
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <bob.blitz/cppapi.h> #include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h> #include <bob.blitz/cleanup.h>
#include <bob.extension/defines.h>
#include "types.h" #include "types.h"
PyDoc_STRVAR(s_spectrogram_str, BOB_EXT_MODULE_PREFIX ".Spectrogram"); PyDoc_STRVAR(s_spectrogram_str, BOB_EXT_MODULE_PREFIX ".Spectrogram");
...@@ -254,7 +255,7 @@ static PyObject* PyBobApSpectrogram_GetNFilters ...@@ -254,7 +255,7 @@ static PyObject* PyBobApSpectrogram_GetNFilters
static int PyBobApSpectrogram_SetNFilters static int PyBobApSpectrogram_SetNFilters
(PyBobApSpectrogramObject* self, PyObject* o, void* /*closure*/) { (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); 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; return -1;
} }
...@@ -291,7 +292,7 @@ static PyObject* PyBobApSpectrogram_GetFMin ...@@ -291,7 +292,7 @@ static PyObject* PyBobApSpectrogram_GetFMin
static int PyBobApSpectrogram_SetFMin static int PyBobApSpectrogram_SetFMin
(PyBobApSpectrogramObject* self, PyObject* o, void* /*closure*/) { (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); 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; return -1;
} }
...@@ -328,7 +329,7 @@ static PyObject* PyBobApSpectrogram_GetFMax ...@@ -328,7 +329,7 @@ static PyObject* PyBobApSpectrogram_GetFMax
static int PyBobApSpectrogram_SetFMax static int PyBobApSpectrogram_SetFMax
(PyBobApSpectrogramObject* self, PyObject* o, void* /*closure*/) { (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); 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; return -1;
} }
...@@ -365,7 +366,7 @@ static PyObject* PyBobApSpectrogram_GetPreEmphasisCoeff ...@@ -365,7 +366,7 @@ static PyObject* PyBobApSpectrogram_GetPreEmphasisCoeff
static int PyBobApSpectrogram_SetPreEmphasisCoeff static int PyBobApSpectrogram_SetPreEmphasisCoeff
(PyBobApSpectrogramObject* self, PyObject* o, void* /*closure*/) { (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); 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; 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