diff options
Diffstat (limited to 'sources/pyside6')
| -rw-r--r-- | sources/pyside6/libpyside/class_property.cpp | 6 | ||||
| -rw-r--r-- | sources/pyside6/libpyside/pysideweakref.cpp | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/sources/pyside6/libpyside/class_property.cpp b/sources/pyside6/libpyside/class_property.cpp index 9deb022f1..c255ef1e9 100644 --- a/sources/pyside6/libpyside/class_property.cpp +++ b/sources/pyside6/libpyside/class_property.cpp @@ -39,9 +39,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; } @@ -125,7 +125,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 2554055e3..79a19fec8 100644 --- a/sources/pyside6/libpyside/pysideweakref.cpp +++ b/sources/pyside6/libpyside/pysideweakref.cpp @@ -51,9 +51,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(); |
