diff options
author | Christian Tismer <tismer@stackless.com> | 2024-02-12 16:24:37 +0100 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2024-03-13 14:53:07 +0100 |
commit | 7accf7c3042e3f0680fa0615a0f13b54d28a0efd (patch) | |
tree | e9f0c87d5bcb67a74a5a60be8374277eb48f545c /sources/pyside6/libpyside/pyside.cpp | |
parent | a6ebf276fd654dd63becdab24d9a9b6a5594f076 (diff) |
LazyInit: Implement Lazy Initialization by Delayed Module Entries
Lazy init is done by module entries which are delayed.
Although visible in the module, the classes are only created
when actually accessed by getattr.
Internally, the access to the global Init_xxx functions is
redirected to a Shiboken::Module::get function which resolves
the classes if not already present in the global type array.
PYSIDE6_OPTION_LAZY
0 - no lazy loading
1 - lazy load all known modules
2 - lazy load all modules
Task-number: PYSIDE-2404
Change-Id: I98c01856e293732c166662050d0fbc6f6ec9082b
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/pyside.cpp')
-rw-r--r-- | sources/pyside6/libpyside/pyside.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sources/pyside6/libpyside/pyside.cpp b/sources/pyside6/libpyside/pyside.cpp index 074c289b8..f4f113d34 100644 --- a/sources/pyside6/libpyside/pyside.cpp +++ b/sources/pyside6/libpyside/pyside.cpp @@ -32,6 +32,7 @@ #include <sbkstring.h> #include <sbkstaticstrings.h> #include <sbkfeature_base.h> +#include <sbkmodule.h> #include <QtCore/QByteArray> #include <QtCore/QCoreApplication> @@ -687,6 +688,13 @@ static const char *typeName(const QObject *cppSelf) typeName = name; break; } + // PYSIDE-2404: Did not find the name. Load the lazy classes + // which have this name and try again. + Shiboken::Module::loadLazyClassesWithName(name); + if (Shiboken::Conversions::getConverter(name)) { + typeName = name; + break; + } } } return typeName; |