aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2023-03-09 17:29:28 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-03-10 22:35:26 +0000
commit7f0897c59ada4bbdc5da45155e4dee1c33fc47f5 (patch)
tree93d02acfbc32415ba5500b658d06033053ec155b
parent0d279fef59450903502f8778363f05c6e464ed9f (diff)
signature: Fix a refcount bug in SetError_Argument
When a real error occurs in `SetError_Argument`, there is an open PyErr_Fetch call that will not be closed because we redirect the whole exception to the `seterror_argument` function in errorhandler.py . This is a similar case as the refcounting leak in `mangled_type_getattro` PYSIDE-2169 . I did not know that PyErr_Fetch/PyErr_Restore use refcounting. Change-Id: I042c1d858c57834d707139f7290bc15b9dd5cc0e Task-number: PYSIDE-1564 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 5599354825bf767a87dfc22cbd260e419d92ef0d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/shiboken6/libshiboken/signature/signature.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/sources/shiboken6/libshiboken/signature/signature.cpp b/sources/shiboken6/libshiboken/signature/signature.cpp
index f83618779..b9e1fec40 100644
--- a/sources/shiboken6/libshiboken/signature/signature.cpp
+++ b/sources/shiboken6/libshiboken/signature/signature.cpp
@@ -583,7 +583,9 @@ void SetError_Argument(PyObject *args, const char *func_name, PyObject *info)
PyObject *e, *v, *t;
// Note: These references are all borrowed.
PyErr_Fetch(&e, &v, &t);
+ Py_DECREF(e);
info = v;
+ Py_XDECREF(t);
}
// PYSIDE-1019: Modify the function name expression according to feature.
AutoDecRef new_func_name(adjustFuncName(func_name));