aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2020-12-08 14:20:46 +0100
committerChristian Tismer <tismer@stackless.com>2020-12-08 16:03:57 +0000
commit76a72315de6cd9ea2f76109a3896d95db4227f64 (patch)
tree51eee0f58127a0be193fda32d0ebaf68fbffbf33
parentf0d4ec002780d937b4b391d2668cd4742528a208 (diff)
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 <Friedemann.Kleint@qt.io>
-rw-r--r--sources/shiboken6/libshiboken/signature/signature.cpp11
1 files 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);
}