aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2022-07-15 15:30:03 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-07-19 17:19:50 +0000
commitc28a6e1524c784b99967bd1d45155c86fd50e561 (patch)
treecb5f253c8482306d535934217b649223f71fcb79
parent66cc5f156554d7ee9525ab9aba38d372b8fcc928 (diff)
Shiboken: use the Python 3.11 buffer interface for Limited API
Because the stable API includes now the bufferprocs, we add a warning to remove the special handling when the lowest version is 3.11 . Unfortunately, I see no other way to use the new buffer interface, because things must work with every Python runtime. But that also does no harm, since this is now in the stable API. And of course, we can remove the boring version check :) Also, an old shiboken error workaround could be removed. XXX No, the shiboken error still exists in RHEL Change-Id: I2fae8cabb2cf116a7365b9cf45618da5238c2ea7 Task-number: PYSIDE-1960 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit a3c1a50eb1577caf3715c47b00ca26312d235a80) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/pyside6/PySide6/glue/qtcore.cpp3
-rw-r--r--sources/shiboken6/libshiboken/pep384impl.h7
-rw-r--r--sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py4
3 files changed, 7 insertions, 7 deletions
diff --git a/sources/pyside6/PySide6/glue/qtcore.cpp b/sources/pyside6/PySide6/glue/qtcore.cpp
index e5b404317..321aa7264 100644
--- a/sources/pyside6/PySide6/glue/qtcore.cpp
+++ b/sources/pyside6/PySide6/glue/qtcore.cpp
@@ -680,7 +680,7 @@ static int SbkQByteArray_getbufferproc(PyObject *obj, Py_buffer *view, int flags
QByteArray * cppSelf = %CONVERTTOCPP[QByteArray *](obj);
//XXX /|\ omitting this space crashes shiboken!
- #ifdef Py_LIMITED_API
+#ifdef Py_LIMITED_API
view->obj = obj;
view->buf = reinterpret_cast<void *>(cppSelf->data());
view->len = cppSelf->size();
@@ -911,7 +911,6 @@ auto *pyTimer = timerType->tp_new(Shiboken::SbkType<QTimer>(), emptyTuple, nullp
timerType->tp_init(pyTimer, emptyTuple, nullptr);
auto timer = %CONVERTTOCPP[QTimer *](pyTimer);
-//XXX /|\ omitting this space crashes shiboken!
Shiboken::AutoDecRef result(
PyObject_CallMethod(pyTimer, "connect", "OsOs",
pyTimer,
diff --git a/sources/shiboken6/libshiboken/pep384impl.h b/sources/shiboken6/libshiboken/pep384impl.h
index 6fcb3af56..1241621cf 100644
--- a/sources/shiboken6/libshiboken/pep384impl.h
+++ b/sources/shiboken6/libshiboken/pep384impl.h
@@ -341,11 +341,8 @@ LIBSHIBOKEN_API PyObject *PyRun_String(const char *, int, PyObject *, PyObject *
// buffer functions.
// But this is no problem as we check it's validity for every version.
-#define PYTHON_BUFFER_VERSION_COMPATIBLE (PY_VERSION_HEX >= 0x03030000 && \
- PY_VERSION_HEX < 0x030C0000)
-#if !PYTHON_BUFFER_VERSION_COMPATIBLE
-# error Please check the buffer compatibility for this python version!
-#endif
+// PYSIDE-1960 The buffer interface is since Python 3.11 part of the stable
+// API and we do not need to check the compatibility by hand anymore.
typedef struct {
getbufferproc bf_getbuffer;
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py
index 7c2237fc3..1d4dadc55 100644
--- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py
+++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py
@@ -102,6 +102,10 @@ def _get_flag_enum_option():
if pyminver and pyminver >= (3, 8):
warnings.warn(f"\n *** Python is at version {'.'.join(map(str, pyminver))} now. "
f"The file pep384_issue33738.cpp should be removed ASAP! ***")
+ # PYSIDE-1960: Emit a warning when we may remove pep384_issue33738.cpp
+ if pyminver and pyminver >= (3, 11):
+ warnings.warn(f"\n *** Python is at version {'.'.join(map(str, pyminver))} now. "
+ f"The files bufferprocs_py37.(cpp|h) should be removed ASAP! ***")
# PYSIDE-1735: Emit a warning when we may update enum_310.py
if pymaxver and pymaxver > (3, 10):
if sys.version_info >= (3, 11, 0) and sys.version_info.releaselevel == "final":