projects
/
aubio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[py] fix reference counting of exception types (thanks @wackou)
[aubio.git]
/
python
/
ext
/
py-filter.c
diff --git
a/python/ext/py-filter.c
b/python/ext/py-filter.c
index
19dcc60
..
220eb13
100644
(file)
--- a/
python/ext/py-filter.c
+++ b/
python/ext/py-filter.c
@@
-163,7
+163,10
@@
Py_filter_set_c_weighting (Py_filter * self, PyObject *args)
// change the RuntimeError into ValueError
PyObject *type, *value, *traceback;
PyErr_Fetch(&type, &value, &traceback);
// change the RuntimeError into ValueError
PyObject *type, *value, *traceback;
PyErr_Fetch(&type, &value, &traceback);
- PyErr_Restore(PyExc_ValueError, value, traceback);
+ Py_XDECREF(type);
+ type = PyExc_ValueError;
+ Py_XINCREF(type);
+ PyErr_Restore(type, value, traceback);
}
return NULL;
}
}
return NULL;
}
@@
-188,7
+191,10
@@
Py_filter_set_a_weighting (Py_filter * self, PyObject *args)
// change the RuntimeError into ValueError
PyObject *type, *value, *traceback;
PyErr_Fetch(&type, &value, &traceback);
// change the RuntimeError into ValueError
PyObject *type, *value, *traceback;
PyErr_Fetch(&type, &value, &traceback);
- PyErr_Restore(PyExc_ValueError, value, traceback);
+ Py_XDECREF(type);
+ type = PyExc_ValueError;
+ Py_XINCREF(type);
+ PyErr_Restore(type, value, traceback);
}
return NULL;
}
}
return NULL;
}
@@
-213,7
+219,10
@@
Py_filter_set_biquad(Py_filter * self, PyObject *args)
// change the RuntimeError into ValueError
PyObject *type, *value, *traceback;
PyErr_Fetch(&type, &value, &traceback);
// change the RuntimeError into ValueError
PyObject *type, *value, *traceback;
PyErr_Fetch(&type, &value, &traceback);
- PyErr_Restore(PyExc_ValueError, value, traceback);
+ Py_XDECREF(type);
+ type = PyExc_ValueError;
+ Py_XINCREF(type);
+ PyErr_Restore(type, value, traceback);
}
return NULL;
}
}
return NULL;
}