diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-01-25 13:13:25 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-01-25 13:48:25 +0100 |
commit | a08ecdefcd7078b6c0aa0cad6e821b0cbf218463 (patch) | |
tree | 392f2fa3dac17a1426f899ad5a254ee19fd5dfb0 | |
parent | c5688f95f008ddea8ccfadccc491052da6a98dd1 (diff) |
shiboken6: Propagate final attribute from C++
[ChangeLog][shiboken6] Classes marked as final in C++ are now
created as final Python classes.
Task-number: PYSIDE-1790
Change-Id: I8ca84fa0b3c267afbe98e15d5b87e759c068b29a
Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r-- | sources/shiboken6/generator/shiboken/cppgenerator.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp index e7f0f5351..09ce927e9 100644 --- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp +++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp @@ -4315,7 +4315,6 @@ void CppGenerator::writeClassDefinition(TextStream &s, const AbstractMetaClass *metaClass, const GeneratorContext &classContext) { - QString tp_flags; QString tp_init; QString tp_new; QString tp_dealloc; @@ -4338,7 +4337,9 @@ void CppGenerator::writeClassDefinition(TextStream &s, const bool isQApp = usePySideExtensions() && metaClass->inheritsFrom(u"QCoreApplication"_qs); - tp_flags = QLatin1String("Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE"); + QString tp_flags = u"Py_TPFLAGS_DEFAULT"_qs; + if (!metaClass->attributes().testFlag(AbstractMetaClass::FinalCppClass)) + tp_flags += u"|Py_TPFLAGS_BASETYPE"_qs; if (metaClass->isNamespace() || metaClass->hasPrivateDestructor()) { tp_dealloc = metaClass->hasPrivateDestructor() ? QLatin1String("SbkDeallocWrapperWithPrivateDtor") : |