diff options
-rw-r--r-- | sources/pyside6/libpyside/class_property.cpp | 6 | ||||
-rw-r--r-- | sources/pyside6/libpyside/pysideweakref.cpp | 8 | ||||
-rw-r--r-- | sources/shiboken6/libshiboken/sbktypefactory.cpp | 2 |
3 files changed, 9 insertions, 7 deletions
diff --git a/sources/pyside6/libpyside/class_property.cpp b/sources/pyside6/libpyside/class_property.cpp index 04b12616e..5f9355f93 100644 --- a/sources/pyside6/libpyside/class_property.cpp +++ b/sources/pyside6/libpyside/class_property.cpp @@ -75,9 +75,9 @@ static int PyClassProperty_descr_set(PyObject *self, PyObject *obj, PyObject *va static int PyClassProperty_tp_init(PyObject *self, PyObject *args, PyObject *kwargs) { auto hold = Py_TYPE(self); - Py_TYPE(self) = &PyProperty_Type; + self->ob_type = &PyProperty_Type; auto ret = PyProperty_Type.tp_init(self, args, kwargs); - Py_TYPE(self) = hold; + self->ob_type = hold; return ret; } @@ -161,7 +161,7 @@ void init(PyObject *module) { PyTypeObject *type = SbkObjectType_TypeF(); type->tp_setattro = SbkObjectType_meta_setattro; - Py_TYPE(PyClassProperty_TypeF()) = type; + reinterpret_cast<PyObject *>(type)->ob_type = type; if (InitSignatureStrings(PyClassProperty_TypeF(), PyClassProperty_SignatureStrings) < 0) return; diff --git a/sources/pyside6/libpyside/pysideweakref.cpp b/sources/pyside6/libpyside/pysideweakref.cpp index 03086a486..46c0f1d6f 100644 --- a/sources/pyside6/libpyside/pysideweakref.cpp +++ b/sources/pyside6/libpyside/pysideweakref.cpp @@ -87,9 +87,11 @@ PyObject *create(PyObject *obj, PySideWeakRefFunction func, void *userData) if (obj == Py_None) return nullptr; - if (Py_TYPE(PySideCallableObject_TypeF()) == nullptr) { - Py_TYPE(PySideCallableObject_TypeF()) = &PyType_Type; - PyType_Ready(PySideCallableObject_TypeF()); + auto *callableObject_Type = PySideCallableObject_TypeF(); + auto *callableObject_PyObject = reinterpret_cast<PyObject *>(callableObject_Type); + if (callableObject_PyObject->ob_type == nullptr) { + callableObject_PyObject->ob_type = &PyType_Type; + PyType_Ready(callableObject_Type); } PyTypeObject *type = PySideCallableObject_TypeF(); diff --git a/sources/shiboken6/libshiboken/sbktypefactory.cpp b/sources/shiboken6/libshiboken/sbktypefactory.cpp index 5efd45a2f..e6e5cd64c 100644 --- a/sources/shiboken6/libshiboken/sbktypefactory.cpp +++ b/sources/shiboken6/libshiboken/sbktypefactory.cpp @@ -116,7 +116,7 @@ PyTypeObject *SbkType_FromSpec_BMDWB(PyType_Spec *spec, if (meta) { PyTypeObject *hold = Py_TYPE(type); - Py_TYPE(type) = meta; + obType->ob_type = meta; Py_INCREF(Py_TYPE(type)); if (hold->tp_flags & Py_TPFLAGS_HEAPTYPE) Py_DECREF(hold); |