aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/libshiboken
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2020-08-13 16:10:10 +0200
committerChristian Tismer <tismer@stackless.com>2020-08-14 10:03:33 +0200
commit58a0d36d9271e91bd21272a9fe3b736dd90db58d (patch)
tree594e7b328845048e60a03de07aad10ea13099d91 /sources/shiboken2/libshiboken
parent4457db11f873b29bd46c268126cbbdea6b397eee (diff)
feature-select: delay the feature switching
Feature switching was written rather naively and happened after almost every module change which can occour very often. This patch is much more careful with switching and uses an ignore code to prevent switching when PySide was not imported at all. A potential regression when a switch is set before some PySide module is being imported and PepType_SOTP is zero was also solved. Task-number: PYSIDE-1019 Change-Id: I24dec7b3e4d0b577f77262392ded0b8a2006b3cc Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/libshiboken')
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp
index 0d2a1975f..c3c16cb02 100644
--- a/sources/shiboken2/libshiboken/basewrapper.cpp
+++ b/sources/shiboken2/libshiboken/basewrapper.cpp
@@ -577,7 +577,11 @@ static int SbkObject_GenericSetAttr(PyObject *obj, PyObject *name, PyObject *val
// Caching the select Id.
int SbkObjectType_GetReserved(PyTypeObject *type)
{
- return PepType_SOTP(reinterpret_cast<SbkObjectType *>(type))->pyside_reserved_bits;
+ auto ptr = PepType_SOTP(reinterpret_cast<SbkObjectType *>(type));
+ // PYSIDE-1019: During import PepType_SOTP is still zero.
+ if (ptr == nullptr)
+ return -1;
+ return ptr->pyside_reserved_bits;
}
void SbkObjectType_SetReserved(PyTypeObject *type, int value)