aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-06-09 16:50:41 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-06-10 13:24:58 +0000
commit1392fe1f6f56426056f65b2baccfb440dd420e13 (patch)
tree5fe2ce211f9909268dd08b6906c1a5505df59513
parentdef30eba531b8474397b8ce27b268e2e18eb2422 (diff)
libshiboken: Fix a crash in Shiboken::Object::isValid() for Python 3.11
The function is passed type objects for class methods, which caused it to crash. The first clause did not catch this, and so it was cast to SbkObject below. Add a type check to prevent this. Task-number: PYSIDE-1960 Change-Id: Icfdd6fefb7156ac5961444bd5395109849a1d66e Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 52df3b8f64d08f412d7f8b12d82fc0ae6f3c741d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/shiboken6/libshiboken/basewrapper.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/sources/shiboken6/libshiboken/basewrapper.cpp b/sources/shiboken6/libshiboken/basewrapper.cpp
index b9d9b47ab..36801cd49 100644
--- a/sources/shiboken6/libshiboken/basewrapper.cpp
+++ b/sources/shiboken6/libshiboken/basewrapper.cpp
@@ -1277,6 +1277,7 @@ bool setCppPointer(SbkObject *sbkObj, PyTypeObject *desiredType, void *cptr)
bool isValid(PyObject *pyObj)
{
if (!pyObj || pyObj == Py_None
+ || PyType_Check(pyObj) != 0
|| Py_TYPE(Py_TYPE(pyObj)) != SbkObjectType_TypeF()) {
return true;
}