Commit 8bfef30 exposed a reference counting error, causing the interpreter to crash before exiting. The solution is to incref the exception type before calling PyErr_Restore.
Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -163,7 +163,10 @@ Py_filter_set_c_weighting (Py_filter * self, PyObject *args) · 162 unmodified lines | ||
| 163 | 163 | // change the RuntimeError into ValueError |
| 164 | 164 | PyObject *type, *value, *traceback; |
| 165 | 165 | PyErr_Fetch(&type, &value, &traceback); |
| 166 | − PyErr_Restore(PyExc_ValueError, value, traceback); | |
| 166 | + Py_XDECREF(type); | |
| 167 | + type = PyExc_ValueError; | |
| 168 | + Py_XINCREF(type); | |
| 169 | + PyErr_Restore(type, value, traceback); | |
| 167 | 170 | } |
| 168 | 171 | return NULL; |
| 169 | 172 | } |
| @@ -188,7 +191,10 @@ Py_filter_set_a_weighting (Py_filter * self, PyObject *args) · 18 unmodified lines | ||
| 188 | 191 | // change the RuntimeError into ValueError |
| 189 | 192 | PyObject *type, *value, *traceback; |
| 190 | 193 | PyErr_Fetch(&type, &value, &traceback); |
| 191 | − PyErr_Restore(PyExc_ValueError, value, traceback); | |
| 194 | + Py_XDECREF(type); | |
| 195 | + type = PyExc_ValueError; | |
| 196 | + Py_XINCREF(type); | |
| 197 | + PyErr_Restore(type, value, traceback); | |
| 192 | 198 | } |
| 193 | 199 | return NULL; |
| 194 | 200 | } |
| @@ -213,7 +219,10 @@ Py_filter_set_biquad(Py_filter * self, PyObject *args) · 18 unmodified lines | ||
| 213 | 219 | // change the RuntimeError into ValueError |
| 214 | 220 | PyObject *type, *value, *traceback; |
| 215 | 221 | PyErr_Fetch(&type, &value, &traceback); |
| 216 | − PyErr_Restore(PyExc_ValueError, value, traceback); | |
| 222 | + Py_XDECREF(type); | |
| 223 | + type = PyExc_ValueError; | |
| 224 | + Py_XINCREF(type); | |
| 225 | + PyErr_Restore(type, value, traceback); | |
| 217 | 226 | } |
| 218 | 227 | return NULL; |
| 219 | 228 | } |