ref: 2244f004403844e28440c956a3a073691845a6d0
parent: 843b22f829c4ccf31487fee9065282c00b695c6f
author: Paul Brossier <piem@piem.org>
date: Sat Jun 29 08:48:56 EDT 2019
[py] incref exception type before restoring it
--- a/python/lib/gen_code.py
+++ b/python/lib/gen_code.py
@@ -509,7 +509,10 @@
// 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;
}}