From 76a72315de6cd9ea2f76109a3896d95db4227f64 Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Tue, 8 Dec 2020 14:20:46 +0100 Subject: cppgenerator: rework keyword handling regarding unknown.. Fixed! The new keyword algorithm did fail again on Windows. But this time it was a refcounting error that was only visible in a debug build. On Windows, it appeared as a negative refcount assertion. On macOS in debug mode, it was a segfault instead. The problem was `PyErr_Fetch()`, a function that uses borrowed references, only. Forgot to respect that, sorry :-( Task-number: PYSIDE-1305 Change-Id: I164668db8143729fa2fab0be1f61757690e13138 Pick-to: 5.15 Reviewed-by: Friedemann Kleint --- sources/shiboken6/libshiboken/signature/signature.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sources/shiboken6/libshiboken/signature/signature.cpp b/sources/shiboken6/libshiboken/signature/signature.cpp index 7f57aa8a3..130aeb778 100644 --- a/sources/shiboken6/libshiboken/signature/signature.cpp +++ b/sources/shiboken6/libshiboken/signature/signature.cpp @@ -521,13 +521,11 @@ void SetError_Argument(PyObject *args, const char *func_name, PyObject *info) init_module_2(); // PYSIDE-1305: Handle errors set by fillQtProperties. - PyObject *err_val{}; if (PyErr_Occurred()) { - PyObject *e, *t; - PyErr_Fetch(&e, &err_val, &t); - info = err_val; - Py_XDECREF(&e); - Py_XDECREF(&t); + PyObject *e, *v, *t; + // Note: These references are all borrowed. + PyErr_Fetch(&e, &v, &t); + info = v; } // PYSIDE-1019: Modify the function name expression according to feature. AutoDecRef new_func_name(adjustFuncName(func_name)); @@ -548,7 +546,6 @@ void SetError_Argument(PyObject *args, const char *func_name, PyObject *info) PyErr_Print(); Py_FatalError("unexpected failure in seterror_argument"); } - Py_XDECREF(err_val); PyErr_SetObject(err, msg); } -- cgit v1.2.3