From: Paul Brossier Date: Sat, 29 Jun 2019 10:48:56 +0000 (+0200) Subject: [py] incref exception type before restoring it X-Git-Url: https://git.aubio.org/?p=aubio.git;a=commitdiff_plain;h=2244f004403844e28440c956a3a073691845a6d0;hp=-c [py] incref exception type before restoring it --- 2244f004403844e28440c956a3a073691845a6d0 diff --git a/python/lib/gen_code.py b/python/lib/gen_code.py index b48f9a04..3db270b4 100644 --- a/python/lib/gen_code.py +++ b/python/lib/gen_code.py @@ -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; }}