Merge branch 'master' into feature/quietmode
[aubio.git] / python / lib / gen_code.py
index b48f9a0..3db270b 100644 (file)
@@ -509,7 +509,10 @@ Pyaubio_{shortname}_set_{param} (Py_{shortname} *self, PyObject *args)
       // 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;
   }}