aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/libpyside/pysidesignal.cpp
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2021-09-11 15:51:02 +0200
committerChristian Tismer <tismer@stackless.com>2021-09-15 15:57:07 +0200
commitd0678ae7cac8f80a5b80042edb13335f438bb9ce (patch)
tree007f401ccdfc2075a9b9aef8e83829b469b46e94 /sources/pyside6/libpyside/pysidesignal.cpp
parent203e8961ecd8b94211845f4f6519788e34dd3230 (diff)
PyPySide: Encapsulate type generation to be PyPy compatible
Type generation in PyPy is critical. When type creation calls PyType_Ready, PyPy freezes the current state of the type object. That has fatal effects, because with the Limited API, we need to patch some types a little _after_ creation. The functionality of this patch is still the same, but type creation is totally encapsulated, and we can do a different implementation for PyPy. [ChangeLog][PySide6] PyPySide: Type creation was completely encapsulated. The implementation can now be rewritten for PyPy. Task-number: PYSIDE-535 Change-Id: Iae0cadb15b631344ae76cea8c104d4b69941c2b0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/pysidesignal.cpp')
-rw-r--r--sources/pyside6/libpyside/pysidesignal.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/sources/pyside6/libpyside/pysidesignal.cpp b/sources/pyside6/libpyside/pysidesignal.cpp
index 2ecae7287..842311fae 100644
--- a/sources/pyside6/libpyside/pysidesignal.cpp
+++ b/sources/pyside6/libpyside/pysidesignal.cpp
@@ -165,14 +165,7 @@ static PyType_Spec PySideSignalType_spec = {
PyTypeObject *PySideSignalTypeF(void)
{
- static PyTypeObject *type = nullptr;
- if (!type) {
- type = reinterpret_cast<PyTypeObject *>(SbkType_FromSpec(&PySideSignalType_spec));
- PyTypeObject *hold = Py_TYPE(type);
- Py_TYPE(type) = PySideMetaSignalTypeF();
- Py_INCREF(Py_TYPE(type));
- Py_DECREF(hold);
- }
+ static auto *type = SbkType_FromSpecWithMeta(&PySideSignalType_spec, PySideMetaSignalTypeF());
return type;
}