diff options
author | Christian Tismer <tismer@stackless.com> | 2020-09-23 13:14:25 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2020-09-24 11:35:12 +0000 |
commit | 03b9069a7e408568e98cc826c0cb7ea2e5035f1c (patch) | |
tree | 0e072296b1a7c5a47a0d305b3a2111322b9e3605 /sources/shiboken2/generator/shiboken2/cppgenerator.cpp | |
parent | 9eee97b5e66c9771e428539eb340b2c2a3756968 (diff) |
Signature: Revert SbkSpecial_Type_Ready to PyType_Ready
The early signature module tried to minimize the visible
changes to the code base. It replaced the `PyType_Ready` call
by a special version which did other things as well.
We replace that special call by a more intuitive function
`InitSignatureStrings` that does exactly that and nothing more.
The functionality of the module is unchanged.
Change-Id: Ic2f9cd29b0352f0a24daa55b01420c77d103c0b2
Task-number: PYSIDE-510
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/generator/shiboken2/cppgenerator.cpp')
-rw-r--r-- | sources/shiboken2/generator/shiboken2/cppgenerator.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index 304a7ba4e..2f76b6dbf 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -595,7 +595,7 @@ void CppGenerator::generateClass(QTextStream &s, const GeneratorContext &classCo sorter.sort(); s << '\n'; - s << "static const char *" << className << "_properties[] = {\n"; + s << "static const char *" << className << "_PropertyStrings[] = {\n"; for (const auto &entry : qAsConst(sorter)) s << INDENT << entry << ",\n"; s << INDENT << NULL_PTR << " // Sentinel\n"; @@ -5171,10 +5171,7 @@ void CppGenerator::writeClassRegister(QTextStream &s, // 4:typeSpec s << INDENT << '&' << chopType(pyTypeName) << "_spec,\n"; - // 5:signatureStrings - s << INDENT << initFunctionName << "_SignatureStrings,\n"; - - // 6:cppObjDtor + // 5:cppObjDtor s << INDENT; if (!metaClass->isNamespace() && !metaClass->hasPrivateDestructor()) { QString dtorClassName = metaClass->qualifiedCppName(); @@ -5190,7 +5187,7 @@ void CppGenerator::writeClassRegister(QTextStream &s, s << "0,\n"; } - // 7:baseType + // 6:baseType const auto base = metaClass->isNamespace() ? metaClass->extendedNamespace() : metaClass->baseClass(); if (base) { @@ -5200,13 +5197,13 @@ void CppGenerator::writeClassRegister(QTextStream &s, s << INDENT << "0,\n"; } - // 8:baseTypes + // 7:baseTypes if (metaClass->baseClassNames().size() > 1) s << INDENT << pyTypeBasesVariable << ',' << Qt::endl; else s << INDENT << "0,\n"; - // 9:wrapperflags + // 8:wrapperflags QByteArrayList wrapperFlags; if (enc) wrapperFlags.append(QByteArrayLiteral("Shiboken::ObjectType::WrapperFlags::InnerClass")); @@ -5220,11 +5217,12 @@ void CppGenerator::writeClassRegister(QTextStream &s, s << INDENT << ");\n"; s << INDENT << Qt::endl; - if (usePySideExtensions()) { - QString className = metaClass->qualifiedCppName(); + s << INDENT << "auto pyType = reinterpret_cast<PyTypeObject *>(" << typePtr << ");\n"; + s << INDENT << "InitSignatureStrings(pyType, " << initFunctionName << "_SignatureStrings);\n"; + + if (usePySideExtensions()) s << INDENT << "SbkObjectType_SetPropertyStrings(reinterpret_cast<PyTypeObject *>(" << typePtr << "), " - << chopType(pyTypeName) << "_properties);\n"; - } + << chopType(pyTypeName) << "_PropertyStrings);\n"; if (!classContext.forSmartPointer()) s << INDENT << cpythonTypeNameExt(classTypeEntry) << Qt::endl; |