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

Replaced inoperative PyNumber_Check by PyArray_IsAnyScalar

parent 784ed7e0
...@@ -278,7 +278,7 @@ static PyObject* PyBobApCeps_GetNCeps ...@@ -278,7 +278,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 (!PyNumber_Check(o)) { if (!PyArray_IsAnyScalar(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 +316,7 @@ static PyObject* PyBobApCeps_GetDeltaWin ...@@ -316,7 +316,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 (!PyNumber_Check(o)) { if (!PyArray_IsAnyScalar(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;
} }
......
...@@ -217,7 +217,7 @@ static PyObject* PyBobApEnergy_GetEnergyFloor ...@@ -217,7 +217,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 (!PyNumber_Check(o)) { if (!PyArray_IsAnyScalar(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;
} }
......
...@@ -219,7 +219,7 @@ static PyObject* PyBobApFrameExtractor_GetSamplingFrequency ...@@ -219,7 +219,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 (!PyNumber_Check(o)) { if (!PyArray_IsAnyScalar(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 +256,7 @@ static PyObject* PyBobApFrameExtractor_GetWinLengthMs ...@@ -256,7 +256,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 (!PyNumber_Check(o)) { if (!PyArray_IsAnyScalar(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 +293,7 @@ static PyObject* PyBobApFrameExtractor_GetWinShiftMs ...@@ -293,7 +293,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 (!PyNumber_Check(o)) { if (!PyArray_IsAnyScalar(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;
} }
...@@ -454,7 +454,7 @@ static PyObject* PyBobApFrameExtractor_GetShape ...@@ -454,7 +454,7 @@ static PyObject* PyBobApFrameExtractor_GetShape
arg = PyList_GET_ITEM(tmp, 0); arg = PyList_GET_ITEM(tmp, 0);
} }
if (PyNumber_Check(arg)) { if (PyInt_Check(arg)) {
return PyBobApFrameExtractor_GetShapeInt(self, args, kwds); return PyBobApFrameExtractor_GetShapeInt(self, args, kwds);
} }
......
...@@ -254,7 +254,7 @@ static PyObject* PyBobApSpectrogram_GetNFilters ...@@ -254,7 +254,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 (!PyNumber_Check(o)) { if (!PyArray_IsAnyScalar(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 +291,7 @@ static PyObject* PyBobApSpectrogram_GetFMin ...@@ -291,7 +291,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 (!PyNumber_Check(o)) { if (!PyArray_IsAnyScalar(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 +328,7 @@ static PyObject* PyBobApSpectrogram_GetFMax ...@@ -328,7 +328,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 (!PyNumber_Check(o)) { if (!PyArray_IsAnyScalar(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 +365,7 @@ static PyObject* PyBobApSpectrogram_GetPreEmphasisCoeff ...@@ -365,7 +365,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 (!PyNumber_Check(o)) { if (!PyArray_IsAnyScalar(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