diff options
Diffstat (limited to 'sources/shiboken6/libshiboken/sbkfeature_base.cpp')
-rw-r--r-- | sources/shiboken6/libshiboken/sbkfeature_base.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/sources/shiboken6/libshiboken/sbkfeature_base.cpp b/sources/shiboken6/libshiboken/sbkfeature_base.cpp index 3b7439262..9e28d1239 100644 --- a/sources/shiboken6/libshiboken/sbkfeature_base.cpp +++ b/sources/shiboken6/libshiboken/sbkfeature_base.cpp @@ -56,9 +56,13 @@ PyObject *getFeatureSelectId() int currentSelectId(PyTypeObject *type) { - int sel = SbkObjectType_GetReserved(type); - // This could theoretically be -1 if used too early. - assert(sel >= 0); + PyObject *PyId = PyObject_GetAttr(type->tp_dict, PyName::select_id()); + if (PyId == nullptr) { + PyErr_Clear(); + return 0x00; + } + int sel = PyLong_AsLong(PyId); + Py_DECREF(PyId); return sel; } @@ -366,17 +370,6 @@ int SbkObject_GenericSetAttr(PyObject *obj, PyObject *name, PyObject *value) return PyObject_GenericSetAttr(obj, name, value); } -// Caching the select Id. -int SbkObjectType_GetReserved(PyTypeObject *type) -{ - return PepType_SOTP(type)->pyside_reserved_bits; -} - -void SbkObjectType_SetReserved(PyTypeObject *type, int value) -{ - PepType_SOTP(type)->pyside_reserved_bits = value; -} - const char **SbkObjectType_GetPropertyStrings(PyTypeObject *type) { return PepType_SOTP(type)->propertyStrings; |