aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-20 21:57:08 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-20 21:57:08 +0200
commita6c3806c49db404d27d953a66d923eddedc51839 (patch)
treed8dc329fb2f31a2caa7ff1d230c1c2ad1f6664a9
parent08444a16c910bc0648cf937c83d14b910b86b020 (diff)
parent639456cabd032b60aa371000a8ca98ddb9d08504 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml4
-rw-r--r--sources/pyside2/PySide2/glue/qtcore.cpp16
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp24
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testcontainer.cpp6
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testtemplates.cpp35
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testtemplates.h1
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.cpp13
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.h2
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase_typedefs.h1
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp8
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.h14
-rw-r--r--sources/shiboken2/ApiExtractor/typesystemparser.cpp4
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp28
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.h2
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.cpp11
16 files changed, 125 insertions, 46 deletions
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index 53ab29382..272f9a766 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -789,7 +789,7 @@
</modify-function>
</object-type>
- <value-type name="QBasicTimer"/>
+ <object-type name="QBasicTimer"/>
<value-type name="QByteArrayMatcher"/>
<value-type name="QCalendar" since="5.14">
<value-type name="YearMonthDay"/>
@@ -1541,7 +1541,7 @@
<enum-type name="SelectionFlag" flags="SelectionFlags"/>
</object-type>
- <value-type name="QItemSelectionRange" hash-function="qHash">
+ <value-type name="QItemSelectionRange">
</value-type>
<object-type name="QAbstractProxyModel" polymorphic-id-expression="qobject_cast&lt;QAbstractProxyModel*&gt;(%1)">
<extra-includes>
diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp
index 834383679..83c8f8656 100644
--- a/sources/pyside2/PySide2/glue/qtcore.cpp
+++ b/sources/pyside2/PySide2/glue/qtcore.cpp
@@ -1681,11 +1681,19 @@ Py_END_ALLOW_THREADS
// @snippet conversion-pyunicode
#ifndef Py_LIMITED_API
Py_UNICODE *unicode = PyUnicode_AS_UNICODE(%in);
-# if defined(Py_UNICODE_WIDE)
+# if defined(Py_UNICODE_WIDE)
// cast as Py_UNICODE can be a different type
-%out = QString::fromUcs4((const uint *)unicode);
-# else
-%out = QString::fromUtf16((const ushort *)unicode, PepUnicode_GetLength(%in));
+# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+%out = QString::fromUcs4(reinterpret_cast<const char32_t *>(unicode));
+# else
+%out = QString::fromUcs4(reinterpret_cast<const uint *>(unicode));
+# endif // Qt 6
+# else // Py_UNICODE_WIDE
+# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+%out = QString::fromUtf16(reinterpret_cast<const char16_t *>(unicode), PepUnicode_GetLength(%in));
+# else
+%out = QString::fromUtf16(reinterpret_cast<const ushort *>(unicode), PepUnicode_GetLength(%in));
+# endif // Qt 6
# endif
#else
wchar_t *temp = PyUnicode_AsWideCharString(%in, NULL);
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index 02450f1c7..b54dc70ef 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -2108,6 +2108,12 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateType(const TypeInfo &_typ
return translateTypeStatic(_typei, currentClass, this, flags, errorMessage);
}
+static bool isNumber(const QString &s)
+{
+ return std::all_of(s.cbegin(), s.cend(),
+ [](QChar c) { return c.isDigit(); });
+}
+
AbstractMetaType *AbstractMetaBuilderPrivate::translateTypeStatic(const TypeInfo &_typei,
AbstractMetaClass *currentClass,
AbstractMetaBuilderPrivate *d,
@@ -2255,6 +2261,15 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateTypeStatic(const TypeInfo
for (int t = 0, size = templateArguments.size(); t < size; ++t) {
const TypeInfo &ti = templateArguments.at(t);
AbstractMetaType *targType = translateTypeStatic(ti, currentClass, d, flags, &errorMessage);
+ // For non-type template parameters, create a dummy type entry on the fly
+ // as is done for classes.
+ if (!targType) {
+ const QString value = ti.qualifiedName().join(colonColon());
+ if (isNumber(value)) {
+ TypeDatabase::instance()->addConstantValueTypeEntry(value, type->typeSystemTypeEntry());
+ targType = translateTypeStatic(ti, currentClass, d, flags, &errorMessage);
+ }
+ }
if (!targType) {
if (errorMessageIn)
*errorMessageIn = msgCannotTranslateTemplateArgument(t, ti, errorMessage);
@@ -2628,14 +2643,11 @@ bool AbstractMetaBuilderPrivate::inheritTemplate(AbstractMetaClass *subclass,
// "template <int R, int C> Matrix<R, C>" and subclass
// "typedef Matrix<2,3> Matrix2x3;". If so, create dummy entries of
// EnumValueTypeEntry for the integer values encountered on the fly.
- const bool isNumber = std::all_of(typeName.cbegin(), typeName.cend(),
- [](QChar c) { return c.isDigit(); });
- if (isNumber) {
+ if (isNumber(typeName)) {
t = typeDb->findType(typeName);
if (!t) {
- t = new ConstantValueTypeEntry(typeName, subclass->typeEntry()->typeSystemTypeEntry());
- t->setCodeGeneration(0);
- typeDb->addType(t);
+ auto parent = subclass->typeEntry()->typeSystemTypeEntry();
+ t = TypeDatabase::instance()->addConstantValueTypeEntry(typeName, parent);
}
} else {
QStringList possibleNames;
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
index 63de317c3..310a751e0 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
@@ -470,6 +470,8 @@ void BuilderPrivate::addTemplateInstantiations(const CXType &type,
// Finally, remove the list "<>" from the type name.
const bool parsed = addTemplateInstantiationsRecursion(type, t)
&& !t->instantiations().isEmpty();
+ if (!parsed)
+ t->setInstantiations({});
const QPair<int, int> pos = parsed
? parseTemplateArgumentList(*typeName, dummyTemplateArgumentHandler)
: t->parseTemplateArgumentList(*typeName);
diff --git a/sources/shiboken2/ApiExtractor/tests/testcontainer.cpp b/sources/shiboken2/ApiExtractor/tests/testcontainer.cpp
index 2234fb4c3..aaa72238c 100644
--- a/sources/shiboken2/ApiExtractor/tests/testcontainer.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testcontainer.cpp
@@ -57,8 +57,10 @@ void TestContainer::testContainerType()
//search for class A
AbstractMetaClass* classA = AbstractMetaClass::findClass(classes, QLatin1String("A"));
QVERIFY(classA);
- QVERIFY(classA->typeEntry()->baseContainerType());
- QCOMPARE(reinterpret_cast<const ContainerTypeEntry*>(classA->typeEntry()->baseContainerType())->type(), ContainerTypeEntry::ListContainer);
+ auto baseContainer = classA->typeEntry()->baseContainerType();
+ QVERIFY(baseContainer);
+ QCOMPARE(reinterpret_cast<const ContainerTypeEntry*>(baseContainer)->containerKind(),
+ ContainerTypeEntry::ListContainer);
}
void TestContainer::testListOfValueType()
diff --git a/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp b/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp
index 926b0bc59..ec3ddb8b2 100644
--- a/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp
@@ -428,8 +428,10 @@ typedef Vector<int> IntVector;
AbstractMetaClass* vector = AbstractMetaClass::findClass(classes, QLatin1String("IntVector"));
QVERIFY(vector);
- QVERIFY(vector->typeEntry()->baseContainerType());
- QCOMPARE(reinterpret_cast<const ContainerTypeEntry*>(vector->typeEntry()->baseContainerType())->type(), ContainerTypeEntry::VectorContainer);
+ auto baseContainer = vector->typeEntry()->baseContainerType();
+ QVERIFY(baseContainer);
+ QCOMPARE(reinterpret_cast<const ContainerTypeEntry*>(baseContainer)->containerKind(),
+ ContainerTypeEntry::VectorContainer);
QCOMPARE(vector->functions().count(), 4);
const AbstractMetaFunction* method = vector->findFunction(QLatin1String("method"));
@@ -443,6 +445,35 @@ typedef Vector<int> IntVector;
QCOMPARE(otherMethod->type()->cppSignature(), QLatin1String("Vector<int >"));
}
+void TestTemplates::testNonTypeTemplates()
+{
+ // PYSIDe-1296, functions with non type templates parameters.
+ const char cppCode[] = R"CPP(
+template <class T, int Size>
+class Array {
+ T array[Size];
+};
+
+Array<int, 2> foo();
+
+)CPP";
+
+ const char xmlCode[] = R"XML(
+<typesystem package='Foo'>
+ <primitive-type name='int'/>
+ <container-type name='Array' type='vector'/>
+ <function signature="foo()"/>
+</typesystem>)XML";
+
+ QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, true));
+ QVERIFY(!builder.isNull());
+ auto functions = builder->globalFunctions();
+ QCOMPARE(functions.count(), 1);
+ auto foo = functions.constFirst();
+ QCOMPARE(foo->name(), QLatin1String("foo"));
+ QCOMPARE(foo->type()->name(), QLatin1String("Array"));
+}
+
// Perform checks on template inheritance; a typedef of a template class
// should result in rewritten types.
void TestTemplates::testTemplateTypeDefs_data()
diff --git a/sources/shiboken2/ApiExtractor/tests/testtemplates.h b/sources/shiboken2/ApiExtractor/tests/testtemplates.h
index 80d97512e..c96e7fe4a 100644
--- a/sources/shiboken2/ApiExtractor/tests/testtemplates.h
+++ b/sources/shiboken2/ApiExtractor/tests/testtemplates.h
@@ -46,6 +46,7 @@ private slots:
void testTemplateInheritanceMixedWithNamespaceAndForwardDeclaration();
void testTypedefOfInstantiationOfTemplateClass();
void testContainerTypeIncompleteArgument();
+ void testNonTypeTemplates();
void testTemplateTypeDefs_data();
void testTemplateTypeDefs();
void testTemplateTypeAliases();
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.cpp b/sources/shiboken2/ApiExtractor/typedatabase.cpp
index ddf43b54a..4a29a25c9 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.cpp
+++ b/sources/shiboken2/ApiExtractor/typedatabase.cpp
@@ -426,6 +426,17 @@ bool TypeDatabase::addType(TypeEntry *e, QString *errorMessage)
return true;
}
+// Add a dummy value entry for non-type template parameters
+ConstantValueTypeEntry *
+ TypeDatabase::addConstantValueTypeEntry(const QString &value,
+ const TypeEntry *parent)
+{
+ auto result = new ConstantValueTypeEntry(value, parent);
+ result->setCodeGeneration(0);
+ addType(result);
+ return result;
+}
+
bool TypeDatabase::isFunctionRejected(const QString& className, const QString& functionName,
QString *reason) const
{
@@ -943,7 +954,7 @@ void NamespaceTypeEntry::formatDebug(QDebug &d) const
void ContainerTypeEntry::formatDebug(QDebug &d) const
{
ComplexTypeEntry::formatDebug(d);
- d << ", type=" << m_type << ",\"" << typeName() << '"';
+ d << ", type=" << m_containerKind << ",\"" << typeName() << '"';
}
void SmartPointerTypeEntry::formatDebug(QDebug &d) const
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.h b/sources/shiboken2/ApiExtractor/typedatabase.h
index 0a0a4eed5..7651d6b7b 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.h
+++ b/sources/shiboken2/ApiExtractor/typedatabase.h
@@ -137,6 +137,8 @@ public:
QString *reason = nullptr) const;
bool addType(TypeEntry *e, QString *errorMessage = nullptr);
+ ConstantValueTypeEntry *addConstantValueTypeEntry(const QString &value,
+ const TypeEntry *parent);
void addTypeSystemType(const TypeSystemTypeEntry *e);
FlagsTypeEntry *findFlagsType(const QString &name) const;
diff --git a/sources/shiboken2/ApiExtractor/typedatabase_typedefs.h b/sources/shiboken2/ApiExtractor/typedatabase_typedefs.h
index 0bb5cde1d..f9e6c669e 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase_typedefs.h
+++ b/sources/shiboken2/ApiExtractor/typedatabase_typedefs.h
@@ -33,6 +33,7 @@
#include <QtCore/QString>
#include <QtCore/QVector>
+class ConstantValueTypeEntry;
class ContainerTypeEntry;
class NamespaceTypeEntry;
class PrimitiveTypeEntry;
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index 0ec158ae1..920da9e10 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystem.cpp
@@ -144,7 +144,7 @@ ComplexTypeEntry::ComplexTypeEntry(const ComplexTypeEntry &) = default;
QString ContainerTypeEntry::qualifiedCppName() const
{
- if (m_type == StringListContainer)
+ if (m_containerKind == StringListContainer)
return QLatin1String("QStringList");
return ComplexTypeEntry::qualifiedCppName();
}
@@ -595,7 +595,7 @@ QString ComplexTypeEntry::targetLangApiName() const
QString ContainerTypeEntry::typeName() const
{
- switch(m_type) {
+ switch (m_containerKind) {
case LinkedListContainer:
return QLatin1String("linked-list");
case ListContainer:
@@ -928,11 +928,11 @@ TypeEntry *TypedefEntry::clone() const
TypedefEntry::TypedefEntry(const TypedefEntry &) = default;
-ContainerTypeEntry::ContainerTypeEntry(const QString &entryName, Type type,
+ContainerTypeEntry::ContainerTypeEntry(const QString &entryName, ContainerKind containerKind,
const QVersionNumber &vr,
const TypeEntry *parent) :
ComplexTypeEntry(entryName, ContainerType, vr, parent),
- m_type(type)
+ m_containerKind(containerKind)
{
setCodeGeneration(GenerateForSubclass);
}
diff --git a/sources/shiboken2/ApiExtractor/typesystem.h b/sources/shiboken2/ApiExtractor/typesystem.h
index 790fb95cb..6d2d4bb44 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.h
+++ b/sources/shiboken2/ApiExtractor/typesystem.h
@@ -1406,7 +1406,7 @@ class ContainerTypeEntry : public ComplexTypeEntry
{
Q_GADGET
public:
- enum Type {
+ enum ContainerKind {
NoContainer,
ListContainer,
StringListContainer,
@@ -1421,14 +1421,14 @@ public:
MultiHashContainer,
PairContainer,
};
- Q_ENUM(Type)
+ Q_ENUM(ContainerKind)
- explicit ContainerTypeEntry(const QString &entryName, Type type, const QVersionNumber &vr,
- const TypeEntry *parent);
+ explicit ContainerTypeEntry(const QString &entryName, ContainerKind containerKind,
+ const QVersionNumber &vr, const TypeEntry *parent);
- Type type() const
+ ContainerKind containerKind() const
{
- return m_type;
+ return m_containerKind;
}
QString typeName() const;
@@ -1443,7 +1443,7 @@ protected:
ContainerTypeEntry(const ContainerTypeEntry &);
private:
- Type m_type;
+ ContainerKind m_containerKind;
};
class SmartPointerTypeEntry : public ComplexTypeEntry
diff --git a/sources/shiboken2/ApiExtractor/typesystemparser.cpp b/sources/shiboken2/ApiExtractor/typesystemparser.cpp
index 45f624762..9fdf81821 100644
--- a/sources/shiboken2/ApiExtractor/typesystemparser.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystemparser.cpp
@@ -297,7 +297,7 @@ ENUM_LOOKUP_BEGIN(TypeSystem::DocModificationMode, Qt::CaseInsensitive,
};
ENUM_LOOKUP_LINEAR_SEARCH()
-ENUM_LOOKUP_BEGIN(ContainerTypeEntry::Type, Qt::CaseSensitive,
+ENUM_LOOKUP_BEGIN(ContainerTypeEntry::ContainerKind, Qt::CaseSensitive,
containerTypeFromAttribute, ContainerTypeEntry::NoContainer)
{
{u"list", ContainerTypeEntry::ListContainer},
@@ -1278,7 +1278,7 @@ ContainerTypeEntry *
return nullptr;
}
const QStringRef typeName = attributes->takeAt(typeIndex).value();
- ContainerTypeEntry::Type containerType = containerTypeFromAttribute(typeName);
+ ContainerTypeEntry::ContainerKind containerType = containerTypeFromAttribute(typeName);
if (containerType == ContainerTypeEntry::NoContainer) {
m_error = QLatin1String("there is no container of type ") + typeName.toString();
return nullptr;
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 28c7bf320..52892663e 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -328,6 +328,7 @@ void CppGenerator::generateClass(QTextStream &s, const GeneratorContext &classCo
s << "#include <algorithm>\n#include <set>\n";
if (metaClass->generateExceptionHandling())
s << "#include <exception>\n";
+ s << "#include <iterator>\n"; // For containers
if (wrapperDiagnostics())
s << "#include <helper.h>\n#include <iostream>\n";
@@ -4134,7 +4135,7 @@ void CppGenerator::writeSequenceMethods(QTextStream &s,
}
if (!injectedCode)
- writeStdListWrapperMethods(s, context);
+ writeDefaultSequenceMethods(s, context);
}
void CppGenerator::writeTypeAsSequenceDefinition(QTextStream &s, const AbstractMetaClass *metaClass)
@@ -6052,14 +6053,17 @@ void CppGenerator::writeReturnValueHeuristics(QTextStream &s, const AbstractMeta
void CppGenerator::writeHashFunction(QTextStream &s, const GeneratorContext &context)
{
const AbstractMetaClass *metaClass = context.metaClass();
- s << "static Py_hash_t " << cpythonBaseName(metaClass) << "_HashFunc(PyObject *self) {\n";
+ const char hashType[] = "Py_hash_t";
+ s << "static " << hashType << ' ' << cpythonBaseName(metaClass)
+ << "_HashFunc(PyObject *self) {\n";
writeCppSelfDefinition(s, context);
- s << INDENT << "return " << metaClass->typeEntry()->hashFunction() << '(';
- s << (isObjectType(metaClass) ? "" : "*") << CPP_SELF_VAR << ");\n";
+ s << INDENT << "return " << hashType << '('
+ << metaClass->typeEntry()->hashFunction() << '('
+ << (isObjectType(metaClass) ? "" : "*") << CPP_SELF_VAR << "));\n";
s<< "}\n\n";
}
-void CppGenerator::writeStdListWrapperMethods(QTextStream &s, const GeneratorContext &context)
+void CppGenerator::writeDefaultSequenceMethods(QTextStream &s, const GeneratorContext &context)
{
const AbstractMetaClass *metaClass = context.metaClass();
ErrorCode errorCode(0);
@@ -6077,8 +6081,10 @@ void CppGenerator::writeStdListWrapperMethods(QTextStream &s, const GeneratorCon
writeCppSelfDefinition(s, context);
writeIndexError(s, QLatin1String("index out of bounds"));
- s << INDENT << metaClass->qualifiedCppName() << "::iterator _item = " << CPP_SELF_VAR << "->begin();\n";
- s << INDENT << "for (Py_ssize_t pos = 0; pos < _i; pos++) _item++;\n";
+ QString value;
+ s << INDENT << metaClass->qualifiedCppName() << "::const_iterator _item = "
+ << CPP_SELF_VAR << "->begin();\n"
+ << INDENT << "std::advance(_item, _i);\n";
const AbstractMetaTypeList instantiations = metaClass->templateBaseClassInstantiations();
if (instantiations.isEmpty()) {
@@ -6112,9 +6118,11 @@ void CppGenerator::writeStdListWrapperMethods(QTextStream &s, const GeneratorCon
s << INDENT << "}\n";
writeArgumentConversion(s, itemType, QLatin1String("cppValue"), QLatin1String("pyArg"), metaClass);
- s << INDENT << metaClass->qualifiedCppName() << "::iterator _item = " << CPP_SELF_VAR << "->begin();\n";
- s << INDENT << "for (Py_ssize_t pos = 0; pos < _i; pos++) _item++;\n";
- s << INDENT << "*_item = cppValue;\n";
+ s << INDENT << metaClass->qualifiedCppName() << "::iterator _item = "
+ << CPP_SELF_VAR << "->begin();\n"
+ << INDENT << "std::advance(_item, _i);\n"
+ << INDENT << "*_item = cppValue;\n";
+
s << INDENT << "return {};\n";
s << "}\n";
}
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.h b/sources/shiboken2/generator/shiboken2/cppgenerator.h
index 5fe67be21..7308f7d18 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.h
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.h
@@ -344,7 +344,7 @@ private:
void writeHashFunction(QTextStream &s, const GeneratorContext &context);
/// Write default implementations for sequence protocol
- void writeStdListWrapperMethods(QTextStream &s, const GeneratorContext &context);
+ void writeDefaultSequenceMethods(QTextStream &s, const GeneratorContext &context);
/// Helper function for writeStdListWrapperMethods.
void writeIndexError(QTextStream &s, const QString &errorMsg);
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
index 5478acb2a..0e8809e97 100644
--- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
@@ -789,7 +789,7 @@ QString ShibokenGenerator::cpythonBaseName(const TypeEntry *type)
baseName = cpythonFlagsName(static_cast<const FlagsTypeEntry *>(type));
} else if (type->isContainer()) {
const auto *ctype = static_cast<const ContainerTypeEntry *>(type);
- switch (ctype->type()) {
+ switch (ctype->containerKind()) {
case ContainerTypeEntry::ListContainer:
case ContainerTypeEntry::StringListContainer:
case ContainerTypeEntry::LinkedListContainer:
@@ -1164,10 +1164,11 @@ QString ShibokenGenerator::cpythonCheckFunction(const AbstractMetaType *metaType
return QLatin1String("PyObject_Check");
return cpythonCheckFunction(metaType->typeEntry(), genericNumberType);
}
- if (metaType->typeEntry()->isContainer()) {
+ auto typeEntry = metaType->typeEntry();
+ if (typeEntry->isContainer()) {
QString typeCheck = QLatin1String("Shiboken::Conversions::");
- ContainerTypeEntry::Type type =
- static_cast<const ContainerTypeEntry *>(metaType->typeEntry())->type();
+ ContainerTypeEntry::ContainerKind type =
+ static_cast<const ContainerTypeEntry *>(typeEntry)->containerKind();
if (type == ContainerTypeEntry::ListContainer
|| type == ContainerTypeEntry::StringListContainer
|| type == ContainerTypeEntry::LinkedListContainer
@@ -1206,7 +1207,7 @@ QString ShibokenGenerator::cpythonCheckFunction(const AbstractMetaType *metaType
}
return typeCheck;
}
- return cpythonCheckFunction(metaType->typeEntry(), genericNumberType);
+ return cpythonCheckFunction(typeEntry, genericNumberType);
}
QString ShibokenGenerator::cpythonCheckFunction(const TypeEntry *type, bool genericNumberType)