aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/libpyside/pysideweakref.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/libpyside/pysideweakref.cpp')
-rw-r--r--sources/pyside6/libpyside/pysideweakref.cpp8
1 files changed, 5 insertions, 3 deletions
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();