diff options
author | Christian Tismer <tismer@stackless.com> | 2022-06-02 14:54:47 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2022-06-03 08:11:18 +0200 |
commit | 563613fefd81090d1947f16259394a830681492d (patch) | |
tree | bc57441a494b8a6d010df182a9e8dddac36262f0 /sources | |
parent | df12cf002002125b8c356155c3a151779d5a3388 (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
Pick-to: 6.2 6.3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources')
-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 15d71f918..4bca53182 100644 --- a/sources/pyside6/PySide6/glue/qtcore.cpp +++ b/sources/pyside6/PySide6/glue/qtcore.cpp @@ -519,7 +519,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"); @@ -560,7 +560,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 d3fb514db..7f3872a58 100644 --- a/sources/shiboken6/libshiboken/pep384_issue33738.cpp +++ b/sources/shiboken6/libshiboken/pep384_issue33738.cpp @@ -106,7 +106,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 172b18162..a1ccad81f 100644 --- a/sources/shiboken6/libshiboken/pep384impl.h +++ b/sources/shiboken6/libshiboken/pep384impl.h @@ -108,15 +108,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 |