diff options
author | Christian Tismer <tismer@stackless.com> | 2022-06-02 14:54:47 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-06-03 10:46:21 +0000 |
commit | 1448aa2ad6963efbc83b223c5c081ab599d3bce1 (patch) | |
tree | 6257fe4f3c022eee3c89cb9a6f08e9617967cb77 | |
parent | e750e8eb3b81dc76b5a82f3b0873a288a04e13dd (diff) |
Limited_API: Fix PyIndex_Check once and for all: avoid warning
The Windows compiler is quite overzealous and complains if headers have different
ordering in the used version, although the content seems to be identical.
Instead of doing a tedious search, we simply rename the function.
Task-number: PYSIDE-1797
Change-Id: I88a8eca882357ac31b9eb932c89013c51c5c75e4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 563613fefd81090d1947f16259394a830681492d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | sources/pyside6/PySide6/glue/qtcore.cpp | 4 | ||||
-rw-r--r-- | sources/shiboken6/libshiboken/pep384_issue33738.cpp | 2 | ||||
-rw-r--r-- | sources/shiboken6/libshiboken/pep384impl.h | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/sources/pyside6/PySide6/glue/qtcore.cpp b/sources/pyside6/PySide6/glue/qtcore.cpp index 68ef88a29..d57bdcc76 100644 --- a/sources/pyside6/PySide6/glue/qtcore.cpp +++ b/sources/pyside6/PySide6/glue/qtcore.cpp @@ -527,7 +527,7 @@ if (ret > 0 && ((strcmp(%1, SIGNAL(destroyed())) == 0) || (strcmp(%1, SIGNAL(des // @snippet qobject-receivers // @snippet qbytearray-mgetitem -if (PyIndex_Check(_key)) { +if (PepIndex_Check(_key)) { const Py_ssize_t _i = PyNumber_AsSsize_t(_key, PyExc_IndexError); if (_i < 0 || _i >= %CPPSELF.size()) { PyErr_SetString(PyExc_IndexError, "index out of bounds"); @@ -568,7 +568,7 @@ return %CONVERTTOPYTHON[QByteArray](ba); // @snippet qbytearray-mgetitem // @snippet qbytearray-msetitem -if (PyIndex_Check(_key)) { +if (PepIndex_Check(_key)) { Py_ssize_t _i = PyNumber_AsSsize_t(_key, PyExc_IndexError); if (_i == -1 && PyErr_Occurred()) return -1; diff --git a/sources/shiboken6/libshiboken/pep384_issue33738.cpp b/sources/shiboken6/libshiboken/pep384_issue33738.cpp index 59713f2f5..aff91e8e7 100644 --- a/sources/shiboken6/libshiboken/pep384_issue33738.cpp +++ b/sources/shiboken6/libshiboken/pep384_issue33738.cpp @@ -142,7 +142,7 @@ static bool is_compatible_version() // There is an automatic warning about this in parser.py . // -LIBSHIBOKEN_API int PyIndex_Check(PyObject *obj) +LIBSHIBOKEN_API int PepIndex_Check(PyObject *obj) { static bool old_python_version = is_compatible_version(); if (old_python_version) { diff --git a/sources/shiboken6/libshiboken/pep384impl.h b/sources/shiboken6/libshiboken/pep384impl.h index 0198ff3f1..b3e930202 100644 --- a/sources/shiboken6/libshiboken/pep384impl.h +++ b/sources/shiboken6/libshiboken/pep384impl.h @@ -144,15 +144,15 @@ typedef struct _typeobject { // PYSIDE-1797: This must be a runtime decision. // Remove that when the minimum Python version is 3.8, -// because the macro PyIndex_Check bug was fixed then. -/// FIXME: Remove PyIndex_Check and pep384_issue33738.cpp when Python 3.7 is gone. -#undef PyIndex_Check -LIBSHIBOKEN_API int PyIndex_Check(PyObject *obj); +// because the macro PepIndex_Check bug was fixed then. +/// FIXME: Remove PepIndex_Check and pep384_issue33738.cpp when Python 3.7 is gone. +LIBSHIBOKEN_API int PepIndex_Check(PyObject *obj); LIBSHIBOKEN_API PyObject *_PepType_Lookup(PyTypeObject *type, PyObject *name); #else // Py_LIMITED_API +#define PepIndex_Check(obj) PyIndex_Check(obj) #define _PepType_Lookup(type, name) _PyType_Lookup(type, name) #endif // Py_LIMITED_API |