From 2244f004403844e28440c956a3a073691845a6d0 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sat, 29 Jun 2019 12:48:56 +0200 Subject: [PATCH 1/1] [py] incref exception type before restoring it --- python/lib/gen_code.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; }} -- 2.11.0