aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/libshiboken/sbkfeature_base.cpp
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2022-11-29 15:03:16 +0100
committerChristian Tismer <tismer@stackless.com>2022-11-29 17:57:32 +0100
commit47a9622599822d5db2dd20f13f369c671c4c4fca (patch)
tree8ea86669a14f7d51dd5568c9c84c032e1a7fcb36 /sources/shiboken6/libshiboken/sbkfeature_base.cpp
parent7377d2b8130ce7290775cd8a343e75c0561fc854 (diff)
__feature__: Remove the no longer efficient reserved_bits structure
The reserved_bits structure is no longer an optimization after moving to PyPy. Accessing any extra field involves always a dict lookup. - remove the reserved_bits field - re-order SbkObjectTypePrivate - replace access functions by currentSelectId() Task-number: PSYIDE-2029 Change-Id: I08642eace9a6399649c039bcc358ce678bbd4fd3 Pick-to: 6.4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/shiboken6/libshiboken/sbkfeature_base.cpp')
-rw-r--r--sources/shiboken6/libshiboken/sbkfeature_base.cpp21
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;