aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/libpyside/pysidemetafunction.cpp
diff options
context:
space:
mode:
authorCristián Maureira-Fredes <cristian.maureira-fredes@qt.io>2024-11-07 09:36:21 +0100
committerCristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>2024-11-08 08:33:38 +0100
commitfb13a26a76eba415e743d119d5d2782c607fee2f (patch)
tree1547b255a7e4afa4e328549d0e613e5b25a45b84 /sources/pyside6/libpyside/pysidemetafunction.cpp
parent2b1dbe1b6610027dbf5f521ae9c7b56f3a343160 (diff)
limited api: replace PySequence_Fast_GET_ITEM by PySequence_GetItem
PySequence_Fast_GET_ITEM is defined as: (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i)) and when using the Limited API we re-define the _GET_ITEM macro to be the _GetItem function, and considering this is our standard use case, the macro could be replaced directly by the function. However, the function returns a new reference, so we need to manually drecrease a reference after the usage, to avoid reference counting issues. Change-Id: If361e80b9e40b033e009ad46b2b9430e5b4c8eaa Pick-to: 6.8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/pysidemetafunction.cpp')
-rw-r--r--sources/pyside6/libpyside/pysidemetafunction.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/sources/pyside6/libpyside/pysidemetafunction.cpp b/sources/pyside6/libpyside/pysidemetafunction.cpp
index 10ba894a7..342ffc04d 100644
--- a/sources/pyside6/libpyside/pysidemetafunction.cpp
+++ b/sources/pyside6/libpyside/pysidemetafunction.cpp
@@ -156,12 +156,13 @@ bool call(QObject *self, int methodIndex, PyObject *args, PyObject **retVal)
methArgs[i] = methValues[i].data();
if (i == 0) // Don't do this for return type
continue;
+ Shiboken::AutoDecRef obj(PySequence_GetItem(sequence.object(), i - 1));
if (metaType.id() == QMetaType::QString) {
QString tmp;
- converter.toCpp(PySequence_Fast_GET_ITEM(sequence.object(), i - 1), &tmp);
+ converter.toCpp(obj, &tmp);
methValues[i] = tmp;
} else {
- converter.toCpp(PySequence_Fast_GET_ITEM(sequence.object(), i - 1), methArgs[i]);
+ converter.toCpp(obj, methArgs[i]);
}
} else {
PyErr_Format(PyExc_TypeError, "Unknown type used to call meta function (that may be a signal): %s", argTypes[i].constData());