aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2024-02-16 18:39:19 +0100
committerChristian Tismer <tismer@stackless.com>2024-03-13 14:53:07 +0100
commit5d05065b57f5e37c2229ff6a2d98d936c5c7f2bb (patch)
tree8fb0e2c53cc453f340495cb36851dc7a8fd6547c
parent7accf7c3042e3f0680fa0615a0f13b54d28a0efd (diff)
LazyInit: Move the get arguments into a static structure
The central get function is used very often. Since the string constants are repeated many times and there seems to be no constant folding, it is better to re-arrange the structure a bit to avoid code bloat. By moving the get arguments into a struct, we avoid all repetitions of string constants and minimize the runtime overhead. The structure is now fully backward compatible and works with unchanged scriptableapplication. Task-number: PYSIDE-2404 Change-Id: Ie7c788ef75cc3d58366532c5f14ab013ebd792b5 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--sources/pyside6/PySide6/glue/qtcore.cpp7
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator.cpp47
-rw-r--r--sources/shiboken6/generator/shiboken/headergenerator.cpp10
-rw-r--r--sources/shiboken6/generator/shiboken/shibokengenerator.cpp56
-rw-r--r--sources/shiboken6/generator/shiboken/shibokengenerator.h6
-rw-r--r--sources/shiboken6/libshiboken/sbkconverter.cpp12
-rw-r--r--sources/shiboken6/libshiboken/sbkconverter.h5
-rw-r--r--sources/shiboken6/libshiboken/sbkmodule.cpp18
-rw-r--r--sources/shiboken6/libshiboken/sbkmodule.h12
-rw-r--r--sources/shiboken6/tests/samplebinding/typesystem_sample.xml4
10 files changed, 132 insertions, 45 deletions
diff --git a/sources/pyside6/PySide6/glue/qtcore.cpp b/sources/pyside6/PySide6/glue/qtcore.cpp
index e48df2679..bc51d26d7 100644
--- a/sources/pyside6/PySide6/glue/qtcore.cpp
+++ b/sources/pyside6/PySide6/glue/qtcore.cpp
@@ -696,7 +696,8 @@ if (PyIndex_Check(_key)) {
PyErr_SetString(PyExc_ValueError, "bytearray must be of size 1");
return -1;
}
- } else if (Py_TYPE(_value) == reinterpret_cast<PyTypeObject *>(SbkPySide6_QtCoreTypes[SBK_QByteArray_IDX])) {
+ } else if (Py_TYPE(_value) == reinterpret_cast<PyTypeObject *>(
+ SbkPySide6_QtCoreTypeStructs[SBK_QByteArray_IDX].type)) {
if (PyObject_Length(_value) != 1) {
PyErr_SetString(PyExc_ValueError, "QByteArray must be of size 1");
return -1;
@@ -733,7 +734,7 @@ if (PySlice_GetIndicesEx(_key, %CPPSELF.size(), &start, &stop, &step, &sliceleng
Py_ssize_t value_length = 0;
if (_value != nullptr && _value != Py_None) {
if (!(PyBytes_Check(_value) || PyByteArray_Check(_value)
- || Py_TYPE(_value) == reinterpret_cast<PyTypeObject *>(SbkPySide6_QtCoreTypes[SBK_QByteArray_IDX]))) {
+ || Py_TYPE(_value) == SbkPySide6_QtCoreTypeStructs[SBK_QByteArray_IDX].type)) {
PyErr_Format(PyExc_TypeError, "bytes, bytearray or QByteArray is required, not %.200s",
Py_TYPE(_value)->tp_name);
return -1;
@@ -1809,7 +1810,7 @@ if (dataChar == nullptr) {
// @snippet qloggingcategory_to_cpp
// PYSIDE-2404: Usage of the `get()` function not necessary, the type exists.
QLoggingCategory *category{nullptr};
- Shiboken::Conversions::pythonToCppPointer(SbkPySide6_QtCoreTypes[SBK_QLoggingCategory_IDX],
+ Shiboken::Conversions::pythonToCppPointer(SbkPySide6_QtCoreTypeStructs[SBK_QLoggingCategory_IDX].type,
pyArgs[0], &(category));
// @snippet qloggingcategory_to_cpp
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
index 55da21d8b..4d33790d8 100644
--- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
@@ -5894,8 +5894,7 @@ void CppGenerator::writeInitFunc(TextStream &declStr, TextStream &callStr,
const TypeEntryCPtr &enclosingEntry,
const QString &pythonName)
{
- const bool hasParent =
- enclosingEntry && enclosingEntry->type() != TypeEntry::TypeSystemType;
+ const bool hasParent = enclosingEntry && enclosingEntry->type() != TypeEntry::TypeSystemType;
declStr << "PyTypeObject *init_" << initFunctionName << "(PyObject *"
<< (hasParent ? "enclosingClass" : "module") << ");\n";
if (hasParent) {
@@ -6077,12 +6076,15 @@ bool CppGenerator::finishGeneration()
s << '\n';
}
+ // FIXME PYSIDE-7: Remove backwards compatible structure
s << "// Current module's type array.\n"
- << "PyTypeObject **" << cppApiVariableName() << " = nullptr;\n"
+ << "Shiboken::Module::TypeInitStruct *" << cppApiVariableName() << " = nullptr;\n"
+ << "// Backwards compatible structure with identical indexing.\n"
+ << "PyTypeObject **" << cppApiVariableNameOld() << " = nullptr;\n"
<< "// Current module's PyObject pointer.\n"
<< "PyObject *" << pythonModuleObjectName() << " = nullptr;\n"
<< "// Current module's converter array.\n"
- << "SbkConverter **" << convertersVariableName() << " = nullptr;\n";
+ << "SbkConverter **" << convertersVariableName() << " = nullptr;\n\n";
const CodeSnipList snips = moduleEntry->codeSnips();
@@ -6091,14 +6093,17 @@ bool CppGenerator::finishGeneration()
// cleanup staticMetaObject attribute
if (usePySideExtensions()) {
+ QString iType = cppApiVariableName() + "[i].type"_L1;
+ QString iName = cppApiVariableName() + "[i].fullName"_L1;
+
s << "void cleanTypesAttributes() {\n" << indent
<< "static PyObject *attrName = Shiboken::PyName::qtStaticMetaObject();\n"
- << "for (int i = 0, imax = SBK_" << moduleName()
- << "_IDX_COUNT; i < imax; i++) {\n" << indent
- << "PyObject *pyType = reinterpret_cast<PyObject *>(" << cppApiVariableName() << "[i]);\n"
- << "if (pyType && PyObject_HasAttr(pyType, attrName))\n" << indent
+ << "const int imax = SBK_" << moduleName() << "_IDX_COUNT;\n"
+ << "for (int i = 0; i < imax && " << iName << " != nullptr; ++i) {\n" << indent
+ << "auto *pyType = reinterpret_cast<PyObject *>(" << iType << ");\n"
+ << "if (pyType != nullptr && PyObject_HasAttr(pyType, attrName))\n" << indent
<< "PyObject_SetAttr(pyType, attrName, Py_None);\n" << outdent
- << outdent << "}\n" << outdent << "}\n";
+ << outdent << "}\n" << outdent << "}\n\n";
}
s << "// Global functions "
@@ -6134,7 +6139,7 @@ bool CppGenerator::finishGeneration()
if (!requiredModules.isEmpty())
s << "// Required modules' type and converter arrays.\n";
for (const QString &requiredModule : requiredModules) {
- s << "PyTypeObject **" << cppApiVariableName(requiredModule) << ";\n"
+ s << "Shiboken::Module::TypeInitStruct *" << cppApiVariableName(requiredModule) << ";\n"
<< "SbkConverter **" << convertersVariableName(requiredModule) << ";\n";
}
@@ -6234,9 +6239,25 @@ bool CppGenerator::finishGeneration()
int maxTypeIndex = getMaxTypeIndex() + api().instantiatedSmartPointers().size();
if (maxTypeIndex) {
- s << "// Create an array of wrapper types for the current module.\n"
- << "static PyTypeObject *cppApi[SBK_" << moduleName() << "_IDX_COUNT];\n"
- << cppApiVariableName() << " = cppApi;\n\n";
+ s << "// Create an array of wrapper types/names for the current module.\n"
+ << "static Shiboken::Module::TypeInitStruct cppApi[] = {\n" << indent;
+
+ // Windows did not like an array of QString.
+ QStringList typeNames;
+ for (int idx = 0; idx < maxTypeIndex; ++idx)
+ typeNames.append("+++ unknown entry #"_L1 + QString::number(idx)
+ + " in "_L1 + moduleName());
+
+ collectFullTypeNamesArray(typeNames);
+
+ for (auto typeName : typeNames)
+ s << "{nullptr, \"" << typeName << "\"},\n";
+
+ s << "{nullptr, nullptr}\n" << outdent << "};\n"
+ << "// The new global structure consisting of (type, name) pairs.\n"
+ << cppApiVariableName() << " = cppApi;\n"
+ << "// The backward compatible alias with upper case indexes.\n"
+ << cppApiVariableNameOld() << " = reinterpret_cast<PyTypeObject **>(cppApi);\n\n";
}
s << "// Create an array of primitive type converters for the current module.\n"
diff --git a/sources/shiboken6/generator/shiboken/headergenerator.cpp b/sources/shiboken6/generator/shiboken/headergenerator.cpp
index 12fff574c..e943d7b87 100644
--- a/sources/shiboken6/generator/shiboken/headergenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/headergenerator.cpp
@@ -649,7 +649,9 @@ HeaderGenerator::IndexValues HeaderGenerator::collectConverterIndexes() const
}
// PYSIDE-2404: Write the enums in unchanged case for reuse in type imports.
-// For conpatibility, we create them in uppercase, too.
+// For conpatibility, we create them in uppercase, too and with
+// doubled index for emulating the former type-only case.
+//
// FIXME: Remove in PySide 7. (See the note in `parser.py`)
//
static IndexValue typeIndexUpper(struct IndexValue const &ti)
@@ -657,7 +659,7 @@ static IndexValue typeIndexUpper(struct IndexValue const &ti)
QString modi = ti.name.toUpper();
if (modi == ti.name)
modi = u"// "_s + modi;
- return {modi, ti.value, ti.comment};
+ return {modi, ti.value * 2, ti.comment};
}
bool HeaderGenerator::finishGeneration()
@@ -689,10 +691,10 @@ bool HeaderGenerator::finishGeneration()
macrosStream << "\n// Type indices\nenum : int {\n";
for (const auto &ti : typeIndexes)
macrosStream << ti;
- macrosStream << "};\n";
+ macrosStream << "};\n\n";
macrosStream << "// This variable stores all Python types exported by this module.\n";
- macrosStream << "extern PyTypeObject **" << cppApiVariableName() << ";\n\n";
+ macrosStream << "extern Shiboken::Module::TypeInitStruct *" << cppApiVariableName() << ";\n\n";
macrosStream << "// This variable stores the Python module object exported by this module.\n";
macrosStream << "extern PyObject *" << pythonModuleObjectName() << ";\n\n";
macrosStream << "// This variable stores all type converters exported by this module.\n";
diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
index 052292329..680f9fc53 100644
--- a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
@@ -724,27 +724,25 @@ QString ShibokenGenerator::converterObject(const TypeEntryCPtr &type)
QString ShibokenGenerator::cpythonTypeNameExtSet(const TypeEntryCPtr &type)
{
return cppApiVariableName(type->targetLangPackage()) + u'['
- + getTypeIndexVariableName(type) + u']';
+ + getTypeIndexVariableName(type) + "].type"_L1;
}
QString ShibokenGenerator::cpythonTypeNameExtSet(const AbstractMetaType &type)
{
return cppApiVariableName(type.typeEntry()->targetLangPackage()) + u'['
- + getTypeIndexVariableName(type) + u']';
+ + getTypeIndexVariableName(type) + "].type"_L1;
}
QString ShibokenGenerator::cpythonTypeNameExt(const TypeEntryCPtr &type)
{
return "Shiboken::Module::get("_L1 + cppApiVariableName(type->targetLangPackage())
- + ", "_L1 + getTypeIndexVariableName(type) + ", \""_L1
- + type->qualifiedTargetLangName() + "\")"_L1;
+ + u'[' + getTypeIndexVariableName(type) + "])"_L1;
}
QString ShibokenGenerator::cpythonTypeNameExt(const AbstractMetaType &type)
{
- return "Shiboken::Module::get("_L1 + cppApiVariableName(type.typeEntry()->targetLangPackage())
- + ", "_L1 + getTypeIndexVariableName(type) + ", \""_L1
- + type.typeEntry()->qualifiedTargetLangName() + "\")"_L1;
+ return u"Shiboken::Module::get("_s + cppApiVariableName(type.typeEntry()->targetLangPackage())
+ + u'[' + getTypeIndexVariableName(type) + "])"_L1;
}
QString ShibokenGenerator::fixedCppTypeName(const TargetToNativeConversion &toNative)
@@ -2442,19 +2440,24 @@ QString ShibokenGenerator::moduleCppPrefix(const QString &moduleName)
return result;
}
+QString ShibokenGenerator::cppApiVariableNameOld(const QString &moduleName)
+{
+ return "Sbk"_L1 + moduleCppPrefix(moduleName) + "Types"_L1;
+}
+
QString ShibokenGenerator::cppApiVariableName(const QString &moduleName)
{
- return u"Sbk"_s + moduleCppPrefix(moduleName) + u"Types"_s;
+ return "Sbk"_L1 + moduleCppPrefix(moduleName) + "TypeStructs"_L1;
}
QString ShibokenGenerator::pythonModuleObjectName(const QString &moduleName)
{
- return u"Sbk"_s + moduleCppPrefix(moduleName) + u"ModuleObject"_s;
+ return "Sbk"_L1 + moduleCppPrefix(moduleName) + "ModuleObject"_L1;
}
QString ShibokenGenerator::convertersVariableName(const QString &moduleName)
{
- QString result = cppApiVariableName(moduleName);
+ QString result = cppApiVariableNameOld(moduleName);
result.chop(1);
result.append(u"Converters"_s);
return result;
@@ -2520,6 +2523,39 @@ QString ShibokenGenerator::getTypeIndexVariableName(const AbstractMetaType &type
return result;
}
+void collectfromTypeEntry(TypeEntryCPtr entry, QStringList &typeNames)
+{
+ if (entry->shouldGenerate()) {
+ typeNames[entry->sbkIndex()] = entry->qualifiedTargetLangName();
+ if (entry->isEnum()) {
+ auto ete = std::static_pointer_cast<const EnumTypeEntry>(entry);
+ if (ete->flags()) {
+ auto entry = ete->flags();
+ typeNames[entry->sbkIndex()] = entry->qualifiedTargetLangName();
+ }
+ }
+ }
+}
+
+void ShibokenGenerator::collectFullTypeNamesArray(QStringList &typeNames)
+{
+ for (const auto &metaClass : api().classes()) {
+ collectfromTypeEntry(metaClass->typeEntry(), typeNames);
+
+ for (const AbstractMetaEnum &metaEnum : metaClass->enums())
+ collectfromTypeEntry(metaEnum.typeEntry(), typeNames);
+
+ int smartPointerCountIndex = getMaxTypeIndex();
+ for (const auto &smp : api().instantiatedSmartPointers()) {
+ auto entry = smp.type.typeEntry();
+ typeNames[smartPointerCountIndex] = entry->qualifiedTargetLangName();
+ ++smartPointerCountIndex;
+ }
+ }
+ for (const AbstractMetaEnum &metaEnum : api().globalEnums())
+ collectfromTypeEntry(metaEnum.typeEntry(), typeNames);
+}
+
bool ShibokenGenerator::verboseErrorMessagesDisabled()
{
return m_options.verboseErrorMessagesDisabled;
diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.h b/sources/shiboken6/generator/shiboken/shibokengenerator.h
index eeff95a6c..22ee73fa2 100644
--- a/sources/shiboken6/generator/shiboken/shibokengenerator.h
+++ b/sources/shiboken6/generator/shiboken/shibokengenerator.h
@@ -281,7 +281,7 @@ protected:
const AbstractMetaClassCPtr &metaClass);
static QString cpythonWrapperCPtr(const AbstractMetaClassCPtr &metaClass,
const QString &argName = QLatin1StringView("self"));
- static QString cpythonWrapperCPtr(const AbstractMetaType &metaType,
+ static QString cpythonWrapperCPtr(const AbstractMetaType &metaType,
const QString &argName);
static QString cpythonWrapperCPtr(const TypeEntryCPtr &type, const QString &argName);
@@ -314,6 +314,7 @@ protected:
static bool useOperatorBoolAsNbBool();
/// Generate implicit conversions of function arguments
static bool generateImplicitConversions();
+ static QString cppApiVariableNameOld(const QString &moduleName = {});
static QString cppApiVariableName(const QString &moduleName = QString());
static QString pythonModuleObjectName(const QString &moduleName = QString());
static QString convertersVariableName(const QString &moduleName = QString());
@@ -325,6 +326,9 @@ protected:
static QString getTypeIndexVariableName(TypeEntryCPtr type);
static QString getTypeIndexVariableName(const AbstractMetaType &type) ;
+ /// Collect all type names as an array for initializing the type/name struct.
+ void collectFullTypeNamesArray(QStringList &typeNames);
+
/// Returns true if the user don't want verbose error messages on the generated bindings.
static bool verboseErrorMessagesDisabled();
diff --git a/sources/shiboken6/libshiboken/sbkconverter.cpp b/sources/shiboken6/libshiboken/sbkconverter.cpp
index 7df42a08e..358827aa8 100644
--- a/sources/shiboken6/libshiboken/sbkconverter.cpp
+++ b/sources/shiboken6/libshiboken/sbkconverter.cpp
@@ -147,6 +147,13 @@ void addPythonToCppValueConversion(PyTypeObject *type,
addPythonToCppValueConversion(sotp->converter, pythonToCppFunc, isConvertibleToCppFunc);
}
+void addPythonToCppValueConversion(Shiboken::Module::TypeInitStruct typeStruct,
+ PythonToCppFunc pythonToCppFunc,
+ IsConvertibleToCppFunc isConvertibleToCppFunc)
+{
+ addPythonToCppValueConversion(typeStruct.type, pythonToCppFunc, isConvertibleToCppFunc);
+}
+
PyObject *pointerToPython(PyTypeObject *type, const void *cppIn)
{
auto *sotp = PepType_SOTP(type);
@@ -228,6 +235,11 @@ PythonToCppConversion pythonToCppPointerConversion(PyTypeObject *type, PyObject
return {};
}
+PythonToCppConversion pythonToCppPointerConversion(Module::TypeInitStruct typeStruct, PyObject *pyIn)
+{
+ return pythonToCppPointerConversion(typeStruct.type, pyIn);
+}
+
static inline PythonToCppFunc IsPythonToCppConvertible(const SbkConverter *converter, PyObject *pyIn)
{
assert(pyIn);
diff --git a/sources/shiboken6/libshiboken/sbkconverter.h b/sources/shiboken6/libshiboken/sbkconverter.h
index 539e3286f..0d68f3faf 100644
--- a/sources/shiboken6/libshiboken/sbkconverter.h
+++ b/sources/shiboken6/libshiboken/sbkconverter.h
@@ -5,6 +5,7 @@
#define SBK_CONVERTER_H
#include "sbkpython.h"
+#include "sbkmodule.h"
#include "shibokenmacros.h"
#include "sbkenum.h"
#include "basewrapper_p.h"
@@ -146,6 +147,9 @@ LIBSHIBOKEN_API void addPythonToCppValueConversion(SbkConverter *converter,
LIBSHIBOKEN_API void addPythonToCppValueConversion(PyTypeObject *type,
PythonToCppFunc pythonToCppFunc,
IsConvertibleToCppFunc isConvertibleToCppFunc);
+LIBSHIBOKEN_API void addPythonToCppValueConversion(Shiboken::Module::TypeInitStruct typeStruct,
+ PythonToCppFunc pythonToCppFunc,
+ IsConvertibleToCppFunc isConvertibleToCppFunc);
// C++ -> Python ---------------------------------------------------------------------------
@@ -203,6 +207,7 @@ struct PythonToCppConversion
*/
LIBSHIBOKEN_API PythonToCppFunc isPythonToCppPointerConvertible(PyTypeObject *type, PyObject *pyIn);
LIBSHIBOKEN_API PythonToCppConversion pythonToCppPointerConversion(PyTypeObject *type, PyObject *pyIn);
+LIBSHIBOKEN_API PythonToCppConversion pythonToCppPointerConversion(Module::TypeInitStruct typeStruct, PyObject *pyIn);
/**
* Returns a Python to C++ conversion function if the Python object is convertible to a C++ value.
diff --git a/sources/shiboken6/libshiboken/sbkmodule.cpp b/sources/shiboken6/libshiboken/sbkmodule.cpp
index 6b06764b5..356cb6220 100644
--- a/sources/shiboken6/libshiboken/sbkmodule.cpp
+++ b/sources/shiboken6/libshiboken/sbkmodule.cpp
@@ -13,7 +13,7 @@
#include <cstring>
/// This hash maps module objects to arrays of Python types.
-using ModuleTypesMap = std::unordered_map<PyObject *, PyTypeObject **> ;
+using ModuleTypesMap = std::unordered_map<PyObject *, Shiboken::Module::TypeInitStruct *> ;
/// This hash maps module objects to arrays of converters.
using ModuleConvertersMap = std::unordered_map<PyObject *, SbkConverter **>;
@@ -38,10 +38,10 @@ namespace Module
// PYSIDE-2404: Replacing the arguments generated by cpythonTypeNameExt
// by a function call.
-LIBSHIBOKEN_API PyTypeObject *get(PyTypeObject **types, int index, const char *typeName)
+LIBSHIBOKEN_API PyTypeObject *get(TypeInitStruct &typeStruct)
{
- if (types[index] != nullptr)
- return types[index];
+ if (typeStruct.type != nullptr)
+ return typeStruct.type;
static PyObject *sysModules = PyImport_GetModuleDict();
@@ -49,7 +49,7 @@ LIBSHIBOKEN_API PyTypeObject *get(PyTypeObject **types, int index, const char *t
// We get the type by following the chain from the module.
// As soon as types[index] gets filled, we can stop.
- std::string_view names(typeName);
+ std::string_view names(typeStruct.fullName);
bool usePySide = names.substr(0, 8) == std::string("PySide6.");
auto dotPos = usePySide ? names.find('.', 8) : names.find('.');
auto startPos = dotPos + 1;
@@ -66,9 +66,9 @@ LIBSHIBOKEN_API PyTypeObject *get(PyTypeObject **types, int index, const char *t
startPos = dotPos + 1;
AutoDecRef obTypeName(String::fromCppStringView(typeName));
modOrType = PyObject_GetAttr(modOrType, obTypeName);
- } while (types[index] == nullptr && dotPos != std::string::npos);
+ } while (typeStruct.type == nullptr && dotPos != std::string::npos);
- return types[index];
+ return typeStruct.type;
}
static PyTypeObject *incarnateType(PyObject *module, const char *name,
@@ -455,14 +455,14 @@ PyObject *create(const char * /* modName */, void *moduleData)
return module;
}
-void registerTypes(PyObject *module, PyTypeObject **types)
+void registerTypes(PyObject *module, TypeInitStruct *types)
{
auto iter = moduleTypes.find(module);
if (iter == moduleTypes.end())
moduleTypes.insert(std::make_pair(module, types));
}
-PyTypeObject **getTypes(PyObject *module)
+TypeInitStruct *getTypes(PyObject *module)
{
auto iter = moduleTypes.find(module);
return (iter == moduleTypes.end()) ? 0 : iter->second;
diff --git a/sources/shiboken6/libshiboken/sbkmodule.h b/sources/shiboken6/libshiboken/sbkmodule.h
index 5cc5dc47b..1b3de33b7 100644
--- a/sources/shiboken6/libshiboken/sbkmodule.h
+++ b/sources/shiboken6/libshiboken/sbkmodule.h
@@ -14,8 +14,14 @@ struct SbkConverter;
namespace Shiboken::Module {
+struct TypeInitStruct
+{
+ PyTypeObject *type;
+ const char *fullName;
+};
+
/// PYSIDE-2404: Replacing the arguments in cpythonTypeNameExt by a function.
-LIBSHIBOKEN_API PyTypeObject *get(PyTypeObject **types, int index, const char *typeName);
+LIBSHIBOKEN_API PyTypeObject *get(TypeInitStruct &typeStruct);
/// PYSIDE-2404: Make sure that mentioned classes really exist.
LIBSHIBOKEN_API void loadLazyClassesWithName(const char *name);
@@ -67,14 +73,14 @@ LIBSHIBOKEN_API void AddTypeCreationFunction(PyObject *module,
* \param module Module where the types were created.
* \param types Array of PyTypeObject *objects representing the types created on \p module.
*/
-LIBSHIBOKEN_API void registerTypes(PyObject *module, PyTypeObject **types);
+LIBSHIBOKEN_API void registerTypes(PyObject *module, TypeInitStruct *types);
/**
* Retrieves the array of types.
* \param module Module where the types were created.
* \returns A pointer to the PyTypeObject *array of types.
*/
-LIBSHIBOKEN_API PyTypeObject **getTypes(PyObject *module);
+LIBSHIBOKEN_API TypeInitStruct *getTypes(PyObject *module);
/**
* Registers the list of converters created by \p module for non-wrapper types.
diff --git a/sources/shiboken6/tests/samplebinding/typesystem_sample.xml b/sources/shiboken6/tests/samplebinding/typesystem_sample.xml
index fcd619932..36134e649 100644
--- a/sources/shiboken6/tests/samplebinding/typesystem_sample.xml
+++ b/sources/shiboken6/tests/samplebinding/typesystem_sample.xml
@@ -633,8 +633,8 @@
// CHECKTYPE and ISCONVERTIBLE are used here for test purposes, don't change them.
if (!%CHECKTYPE[ObjectTypeLayout*](layout) &amp;&amp; !%ISCONVERTIBLE[ObjectTypeLayout*](layout))
return;
- // %CHECKTYPE[ObjectTypeLayout*](layout)
- // %ISCONVERTIBLE[ObjectTypeLayout*](layout)
+ /* %CHECKTYPE[ObjectTypeLayout*](layout) */
+ /* %ISCONVERTIBLE[ObjectTypeLayout*](layout) */
ObjectTypeLayout* var;
var = %CONVERTTOCPP[ObjectTypeLayout*](layout);
// TODO-CONVERTER: erase this