aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2019-04-16 15:26:58 +0200
committerChristian Tismer <tismer@stackless.com>2019-04-16 20:35:02 +0000
commitcd9bc47c1371da645ec709107cb612a8e8bf7040 (patch)
tree3f6f9e0f94e361f3889e0c892c6df8da82862975
parentf21206eb95572af8759366fb249c868659c5674c (diff)
Make the PepType_AS_BUFFER definition complete
PepType_AS_BUFFER should also be defined for the non-Limited API version to avoid ugly #ifdef constructs. This patch augments the definition and simplifies qtcore.cpp . Change-Id: Iddfb39e8afaf992f4edf72d871eec1eaf85d5963 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--sources/pyside2/PySide2/glue/qtcore.cpp4
-rw-r--r--sources/shiboken2/libshiboken/pep384impl.h1
2 files changed, 1 insertions, 4 deletions
diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp
index 6259724c3..fde016548 100644
--- a/sources/pyside2/PySide2/glue/qtcore.cpp
+++ b/sources/pyside2/PySide2/glue/qtcore.cpp
@@ -1139,11 +1139,7 @@ if (PyBytes_Check(%PYARG_1)) {
Shiboken::SbkType<QByteArray>()->tp_as_buffer = &SbkQByteArrayBufferProc;
Shiboken::SbkType<QByteArray>()->tp_flags |= Py_TPFLAGS_HAVE_NEWBUFFER;
#else
-#ifdef Py_LIMITED_API
PepType_AS_BUFFER(Shiboken::SbkType<QByteArray>()) = &SbkQByteArrayBufferProc;
-#else
-Shiboken::SbkType<QByteArray>()->tp_as_buffer = &SbkQByteArrayBufferProc;
-#endif
#endif
// @snippet qbytearray-py3
diff --git a/sources/shiboken2/libshiboken/pep384impl.h b/sources/shiboken2/libshiboken/pep384impl.h
index d883677ce..ffbc570a8 100644
--- a/sources/shiboken2/libshiboken/pep384impl.h
+++ b/sources/shiboken2/libshiboken/pep384impl.h
@@ -316,6 +316,7 @@ LIBSHIBOKEN_API void PyBuffer_Release(Pep_buffer *view);
#else
#define Pep_buffer Py_buffer
+#define PepType_AS_BUFFER(type) ((type)->tp_as_buffer)
#endif /* Py_LIMITED_API */