diff options
author | Cristián Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2024-11-07 10:59:03 +0100 |
---|---|---|
committer | Cristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io> | 2024-11-08 08:33:38 +0100 |
commit | 57cf99afc5fcbc7608790a42471667ed6d7bdea3 (patch) | |
tree | 96f426bb1ff7b22c8d89679edd19ca1c7faf4469 /sources/pyside6/libpyside | |
parent | fb13a26a76eba415e743d119d5d2782c607fee2f (diff) |
limited api: replace PySequence_Fast_GET_SIZE by PySequence_Size
PySequence_Fast_GET_SIZE is defined as:
(PyList_Check(o) ? PyList_GET_SIZE(o) : PyTuple_GET_SIZE(o))
and when using the Limited API we re-define the _GET_SIZE macro
to be the _Size function, and considering this is our standard
use case, the macro could be replaced directly by the function.
Replacing also some cases were int was used instead of Py_ssize_t
when using PySequence_Size.
Pick-to: 6.8
Change-Id: I31aecd571a1d8ea82a3441f0b9e16ee19f026b05
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside')
-rw-r--r-- | sources/pyside6/libpyside/pysidemetafunction.cpp | 2 | ||||
-rw-r--r-- | sources/pyside6/libpyside/pysidesignal.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/sources/pyside6/libpyside/pysidemetafunction.cpp b/sources/pyside6/libpyside/pysidemetafunction.cpp index 342ffc04d..fecd5192a 100644 --- a/sources/pyside6/libpyside/pysidemetafunction.cpp +++ b/sources/pyside6/libpyside/pysidemetafunction.cpp @@ -107,7 +107,7 @@ bool call(QObject *self, int methodIndex, PyObject *args, PyObject **retVal) // args given plus return type Shiboken::AutoDecRef sequence(PySequence_Fast(args, nullptr)); - qsizetype numArgs = PySequence_Fast_GET_SIZE(sequence.object()) + 1; + qsizetype numArgs = PySequence_Size(sequence.object()) + 1; if (numArgs - 1 > argTypes.size()) { PyErr_Format(PyExc_TypeError, "%s only accepts %d argument(s), %d given!", diff --git a/sources/pyside6/libpyside/pysidesignal.cpp b/sources/pyside6/libpyside/pysidesignal.cpp index 13d95fa09..aaffc9548 100644 --- a/sources/pyside6/libpyside/pysidesignal.cpp +++ b/sources/pyside6/libpyside/pysidesignal.cpp @@ -592,7 +592,7 @@ static PyObject *signalInstanceEmit(PyObject *self, PyObject *args) return PyErr_Format(PyExc_RuntimeError, "The SignalInstance object was already deleted"); Shiboken::AutoDecRef pyArgs(PyList_New(0)); - int numArgsGiven = PySequence_Fast_GET_SIZE(args); + Py_ssize_t numArgsGiven = PySequence_Size(args); int numArgsInSignature = argCountInSignature(source->d->signature); // If number of arguments given to emit is smaller than the first source signature expects, |