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.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/sources/pyside6/libpyside/pysideweakref.cpp b/sources/pyside6/libpyside/pysideweakref.cpp
index c0ef2586f..5f3ca59e4 100644
--- a/sources/pyside6/libpyside/pysideweakref.cpp
+++ b/sources/pyside6/libpyside/pysideweakref.cpp
@@ -15,23 +15,28 @@ struct PySideCallableObject {
static PyObject *CallableObject_call(PyObject *callable_object, PyObject *args, PyObject *kw);
-static PyType_Slot PySideCallableObjectType_slots[] = {
- {Py_tp_call, reinterpret_cast<void *>(CallableObject_call)},
- {Py_tp_dealloc, reinterpret_cast<void *>(Sbk_object_dealloc)},
- {0, nullptr}
-};
-static PyType_Spec PySideCallableObjectType_spec = {
- "1:PySide.Callable",
- sizeof(PySideCallableObject),
- 0,
- Py_TPFLAGS_DEFAULT,
- PySideCallableObjectType_slots,
-};
-
+static PyTypeObject *createCallableObjectType()
+{
+ PyType_Slot PySideCallableObjectType_slots[] = {
+ {Py_tp_call, reinterpret_cast<void *>(CallableObject_call)},
+ {Py_tp_dealloc, reinterpret_cast<void *>(Sbk_object_dealloc)},
+ {0, nullptr}
+ };
+
+ PyType_Spec PySideCallableObjectType_spec = {
+ "1:PySide.Callable",
+ sizeof(PySideCallableObject),
+ 0,
+ Py_TPFLAGS_DEFAULT,
+ PySideCallableObjectType_slots,
+ };
+
+ return SbkType_FromSpec(&PySideCallableObjectType_spec);
+}
static PyTypeObject *PySideCallableObject_TypeF()
{
- static auto *type = SbkType_FromSpec(&PySideCallableObjectType_spec);
+ static auto *type = createCallableObjectType();
return type;
}