diff options
| author | Cristián Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2024-11-07 10:59:03 +0100 |
|---|---|---|
| committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-11-08 08:38:10 +0000 |
| commit | 690724cb2691c7dd60d91082b2edb7524669fb56 (patch) | |
| tree | 14caff2bc94f357e98996e28baccde00ae34bd01 /sources/pyside6/libpyside | |
| parent | 8d614f8f9d1ef23ca1c6d82b457c465ee5138a27 (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.
Change-Id: I31aecd571a1d8ea82a3441f0b9e16ee19f026b05
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 57cf99afc5fcbc7608790a42471667ed6d7bdea3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
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, |
