aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/libpyside/pysideweakref.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/libpyside/pysideweakref.cpp')
-rw-r--r--sources/pyside2/libpyside/pysideweakref.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/sources/pyside2/libpyside/pysideweakref.cpp b/sources/pyside2/libpyside/pysideweakref.cpp
index cd90634bd..707df98f5 100644
--- a/sources/pyside2/libpyside/pysideweakref.cpp
+++ b/sources/pyside2/libpyside/pysideweakref.cpp
@@ -88,10 +88,11 @@ PyObject *create(PyObject *obj, PySideWeakRefFunction func, void *userData)
if (obj == Py_None)
return 0;
- if (Py_TYPE(PySideCallableObjectTypeF()) == 0)
- {
- Py_TYPE(PySideCallableObjectTypeF()) = &PyType_Type;
- PyType_Ready(PySideCallableObjectTypeF());
+ auto *callableObject_Type = PySideCallableObjectTypeF();
+ 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 = PySideCallableObjectTypeF();