History

python/ext/py-fft.c: improve error message, dont delete if not created

Paul Brossier committed 10 years ago

Commit 23982aa1 parent fcef3fd1 file · +8 −4Browse files

Showing the changes to python/ext (1 of 1 file). Show all

Unified · Split

python/ext/py-fft.c+8−4
@@ -51,9 +51,11 @@ Py_fft_init (Py_fft * self, PyObject * args, PyObject * kwds) · 50 unmodified lines
5151 {
5252 self->o = new_aubio_fft (self->win_s);
5353 if (self->o == NULL) {
54− char_t errstr[30];
55− sprintf(errstr, "error creating fft with win_s=%d", self->win_s);
56− PyErr_SetString (PyExc_Exception, errstr);
54+ PyErr_Format(PyExc_RuntimeError,
55+ "error creating fft with win_s=%d "
56+ "(should be a power of 2 greater than 1; "
57+ "try recompiling aubio with --enable-fftw3)",
58+ self->win_s);
5759 return -1;
5860 }
5961
@@ -68,7 +70,9 @@ Py_fft_del (Py_fft *self, PyObject *unused) · 8 unmodified lines
6870 {
6971 Py_XDECREF(self->doout);
7072 Py_XDECREF(self->rdoout);
71− del_aubio_fft(self->o);
73+ if (self->o) {
74+ del_aubio_fft(self->o);
75+ }
7276 Py_TYPE(self)->tp_free((PyObject *) self);
7377 }
7478

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t