diff options
author | Christian Tismer <tismer@stackless.com> | 2023-08-27 18:13:19 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2023-08-31 22:42:45 +0200 |
commit | c0b74a7947b7f342fbf70fce8a5111094c5be0b5 (patch) | |
tree | 433820c3bfc282116a4f5ae357067e27fdb1ce82 /sources/shiboken6/libshiboken/signature/signature.cpp | |
parent | 7c1ac18f4a23fb1e471b6ca6dabfabbb89cea02a (diff) |
Signature: Move all initialization into InitSignatureStrings
The signature module built its own mapping for static methods.
This was a post process after a module was imported.
All other mappings worked from alone.
Unfortunately, by lazy loading all classes of a module, the
final enumeration of all functions comes too early and does
no more find anything because the classes and their methods
are initialized later.
Move this functionality right at the end of InitSignatureStrings.
This cleanup is generally a simplification and applicable
for earlier versions.
Task-number: PYSIDE-2404
Change-Id: Id6af49278fb8c90920eda9f9734e5231a5a2e2bd
Pick-to: 6.5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'sources/shiboken6/libshiboken/signature/signature.cpp')
-rw-r--r-- | sources/shiboken6/libshiboken/signature/signature.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sources/shiboken6/libshiboken/signature/signature.cpp b/sources/shiboken6/libshiboken/signature/signature.cpp index 692409214..25bab87d4 100644 --- a/sources/shiboken6/libshiboken/signature/signature.cpp +++ b/sources/shiboken6/libshiboken/signature/signature.cpp @@ -428,8 +428,6 @@ static int PySide_FinishSignatures(PyObject *module, const char *signatures[]) if (PyCFunction_Check(func)) if (PyDict_SetItem(pyside_globals->map_dict, func, module) < 0) return -1; - if (_finish_nested_classes(obdict) < 0) - return -1; // The finish_import function will not work the first time since phase 2 // was not yet run. But that is ok, because the first import is always for // the shiboken module (or a test module). @@ -451,10 +449,12 @@ static int PySide_FinishSignatures(PyObject *module, const char *signatures[]) int InitSignatureStrings(PyTypeObject *type, const char *signatures[]) { + // PYSIDE-2404: This function now also builds the mapping for static methods. + // It was one missing spot to let Lazy import work. init_shibokensupport_module(); auto *ob_type = reinterpret_cast<PyObject *>(type); int ret = PySide_BuildSignatureArgs(ob_type, signatures); - if (ret < 0) { + if (ret < 0 || _build_func_to_type(ob_type) < 0) { PyErr_Print(); PyErr_SetNone(PyExc_ImportError); } |