Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/pyside2/PySide2/QtAxContainer/typesystem_axcontainer.xml8
-rw-r--r--sources/pyside2/libpyside/pysideproperty.cpp20
-rw-r--r--sources/pyside2/libpyside/pysideproperty.h18
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp5
-rw-r--r--sources/shiboken2/generator/generator.cpp3
-rw-r--r--sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp30
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp18
-rw-r--r--sources/shiboken2/generator/shiboken2/ctypenames.h56
-rw-r--r--sources/shiboken2/generator/shiboken2/overloaddata.cpp58
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.cpp27
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.h3
-rw-r--r--sources/shiboken2/shibokenmodule/files.dir/shibokensupport/__feature__.py6
-rw-r--r--tools/create_changelog.py7
13 files changed, 150 insertions, 109 deletions
diff --git a/sources/pyside2/PySide2/QtAxContainer/typesystem_axcontainer.xml b/sources/pyside2/PySide2/QtAxContainer/typesystem_axcontainer.xml
index a331b6988..03977fcbf 100644
--- a/sources/pyside2/PySide2/QtAxContainer/typesystem_axcontainer.xml
+++ b/sources/pyside2/PySide2/QtAxContainer/typesystem_axcontainer.xml
@@ -54,12 +54,16 @@
<object-type name="QAxScript">
<enum-type name="FunctionFlags"/>
</object-type>
- <object-type name="QAxScriptEngine"/>
+ <object-type name="QAxScriptEngine">
+ <enum-type name="State"/>
+ </object-type>
<object-type name="QAxScriptManager">
<!-- Ax Servers only -->
<modify-function signature="addObject(QObject*)" remove="all"/>
</object-type>
- <object-type name="QAxSelect"/>
<object-type name="QAxBaseWidget"/>
+ <object-type name="QAxSelect">
+ <enum-type name="SandboxingLevel"/>
+ </object-type>
<object-type name="QAxWidget"/>
</typesystem>
diff --git a/sources/pyside2/libpyside/pysideproperty.cpp b/sources/pyside2/libpyside/pysideproperty.cpp
index f169c63e1..c902afc0c 100644
--- a/sources/pyside2/libpyside/pysideproperty.cpp
+++ b/sources/pyside2/libpyside/pysideproperty.cpp
@@ -73,7 +73,7 @@ static PyMethodDef PySidePropertyMethods[] = {
};
static PyGetSetDef PySidePropertyType_getset[] = {
- {"__doc__", qPropertyDocGet, nullptr, nullptr, nullptr},
+ {const_cast<char *>("__doc__"), qPropertyDocGet, nullptr, nullptr, nullptr},
{nullptr, nullptr, nullptr, nullptr, nullptr}
};
@@ -158,7 +158,7 @@ static PyObject *qpropertyTpNew(PyTypeObject *subtype, PyObject * /* args */, Py
return reinterpret_cast<PyObject *>(me);
}
-int qpropertyTpInit(PyObject *self, PyObject *args, PyObject *kwds)
+static int qpropertyTpInit(PyObject *self, PyObject *args, PyObject *kwds)
{
PyObject *type = nullptr;
auto data = reinterpret_cast<PySideProperty *>(self);
@@ -209,7 +209,7 @@ int qpropertyTpInit(PyObject *self, PyObject *args, PyObject *kwds)
return -1;
}
-void qpropertyDeAlloc(PyObject *self)
+static void qpropertyDeAlloc(PyObject *self)
{
qpropertyClear(self);
if (PepRuntime_38_flag) {
@@ -220,7 +220,7 @@ void qpropertyDeAlloc(PyObject *self)
Py_TYPE(self)->tp_free(self);
}
-PyObject *qPropertyCall(PyObject *self, PyObject *args, PyObject * /* kw */)
+static PyObject *qPropertyCall(PyObject *self, PyObject *args, PyObject * /* kw */)
{
PyObject *callback = PyTuple_GetItem(args, 0);
if (PyFunction_Check(callback)) {
@@ -237,7 +237,7 @@ PyObject *qPropertyCall(PyObject *self, PyObject *args, PyObject * /* kw */)
return nullptr;
}
-PyObject *qPropertySetter(PyObject *self, PyObject *callback)
+static PyObject *qPropertySetter(PyObject *self, PyObject *callback)
{
if (PyFunction_Check(callback)) {
PySideProperty *prop = reinterpret_cast<PySideProperty *>(self);
@@ -253,7 +253,7 @@ PyObject *qPropertySetter(PyObject *self, PyObject *callback)
return nullptr;
}
-PyObject *qPropertyGetter(PyObject *self, PyObject *callback)
+static PyObject *qPropertyGetter(PyObject *self, PyObject *callback)
{
if (PyFunction_Check(callback)) {
PySideProperty *prop = reinterpret_cast<PySideProperty *>(self);
@@ -282,8 +282,7 @@ static PyObject *qPropertyDocGet(PyObject *self, void *)
return PyString_FromString(doc);
#endif
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
@@ -424,11 +423,6 @@ PySideProperty *getObject(PyObject *source, PyObject *name)
{
PyObject *attr = nullptr;
- if (Shiboken::Object::isUserType(source)) {
- if (auto dict = reinterpret_cast<SbkObject *>(source)->ob_dict)
- attr = PyDict_GetItem(dict, name);
- }
-
attr = getFromType(Py_TYPE(source), name);
if (attr && checkType(attr)) {
Py_INCREF(attr);
diff --git a/sources/pyside2/libpyside/pysideproperty.h b/sources/pyside2/libpyside/pysideproperty.h
index a97b2a48f..4a467b186 100644
--- a/sources/pyside2/libpyside/pysideproperty.h
+++ b/sources/pyside2/libpyside/pysideproperty.h
@@ -62,7 +62,7 @@ namespace PySide { namespace Property {
typedef void (*MetaCallHandler)(PySideProperty*,PyObject*,QMetaObject::Call, void**);
-PYSIDE_API bool checkType(PyObject* pyObj);
+PYSIDE_API bool checkType(PyObject *pyObj);
/**
* This function call set property function and pass value as arg
@@ -73,7 +73,7 @@ PYSIDE_API bool checkType(PyObject* pyObj);
* @param value The value to set in property
* @return Return 0 if ok or -1 if this function fail
**/
-PYSIDE_API int setValue(PySideProperty* self, PyObject* source, PyObject* value);
+PYSIDE_API int setValue(PySideProperty *self, PyObject *source, PyObject *value);
/**
* This function call get property function
@@ -83,7 +83,7 @@ PYSIDE_API int setValue(PySideProperty* self, PyObject* source, PyObject* value)
* @param source The QObject witch has the property
* @return Return the result of property get function or 0 if this fail
**/
-PYSIDE_API PyObject* getValue(PySideProperty* self, PyObject* source);
+PYSIDE_API PyObject *getValue(PySideProperty *self, PyObject *source);
/**
* This function return the notify name used on this property
@@ -91,7 +91,7 @@ PYSIDE_API PyObject* getValue(PySideProperty* self, PyObject* source);
* @param self The property object
* @return Return a const char with the notify name used
**/
-PYSIDE_API const char* getNotifyName(PySideProperty* self);
+PYSIDE_API const char *getNotifyName(PySideProperty *self);
/**
@@ -101,14 +101,14 @@ PYSIDE_API const char* getNotifyName(PySideProperty* self);
* @param name The property name
* @return Return a new reference to property object
**/
-PYSIDE_API PySideProperty* getObject(PyObject* source, PyObject* name);
+PYSIDE_API PySideProperty *getObject(PyObject *source, PyObject *name);
-PYSIDE_API void setMetaCallHandler(PySideProperty* self, MetaCallHandler handler);
+PYSIDE_API void setMetaCallHandler(PySideProperty *self, MetaCallHandler handler);
-PYSIDE_API void setTypeName(PySideProperty* self, const char* typeName);
+PYSIDE_API void setTypeName(PySideProperty *self, const char *typeName);
-PYSIDE_API void setUserData(PySideProperty* self, void* data);
-PYSIDE_API void* userData(PySideProperty* self);
+PYSIDE_API void setUserData(PySideProperty *self, void *data);
+PYSIDE_API void* userData(PySideProperty *self);
} //namespace Property
} //namespace PySide
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index 33596e235..ed80b82f8 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -1292,7 +1292,7 @@ void AbstractMetaBuilderPrivate::traverseFunctions(ScopeModelItem scopeItem,
classFunctionList(scopeItem, &constructorAttributes, metaClass);
metaClass->setAttributes(metaClass->attributes() | constructorAttributes);
- for (AbstractMetaFunction *metaFunction : functions){
+ for (AbstractMetaFunction *metaFunction : functions) {
metaFunction->setOriginalAttributes(metaFunction->attributes());
if (metaClass->isNamespace())
*metaFunction += AbstractMetaAttributes::Static;
@@ -1307,7 +1307,8 @@ void AbstractMetaBuilderPrivate::traverseFunctions(ScopeModelItem scopeItem,
}
} else if (QPropertySpec *write = metaClass->propertySpecForWrite(metaFunction->name())) {
// Property setter must be in the form "void name(<type>)"
- // make sure the function was created with all aguments, some argument can be missing during the pareser because of errors on typesystem
+ // Make sure the function was created with all arguments; some argument can be
+ // missing during the parsing because of errors in the typesystem.
if ((!metaFunction->type()) && (metaFunction->arguments().size() == 1) && (write->type() == metaFunction->arguments().at(0)->type()->typeEntry())) {
*metaFunction += AbstractMetaAttributes::PropertyWriter;
metaFunction->setPropertySpec(write);
diff --git a/sources/shiboken2/generator/generator.cpp b/sources/shiboken2/generator/generator.cpp
index 0be7d1e15..d3b52cdcb 100644
--- a/sources/shiboken2/generator/generator.cpp
+++ b/sources/shiboken2/generator/generator.cpp
@@ -27,6 +27,7 @@
****************************************************************************/
#include "generator.h"
+#include "ctypenames.h"
#include "abstractmetalang.h"
#include "parser/codemodel.h"
#include "messages.h"
@@ -860,7 +861,7 @@ QString Generator::translateType(const AbstractMetaType *cType,
} else if (cType->isArray()) {
s = translateType(cType->arrayElementType(), context, options) + QLatin1String("[]");
} else if ((options & Generator::EnumAsInts) && useEnumAsIntForProtectedHack(cType)) {
- s = QLatin1String("int");
+ s = intT();
} else {
if (options & Generator::OriginalName) {
s = cType->originalTypeDescription().trimmed();
diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
index 878ad9d57..5cc5dcc67 100644
--- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
+++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
@@ -27,6 +27,7 @@
****************************************************************************/
#include "qtdocgenerator.h"
+#include "ctypenames.h"
#include <abstractmetalang.h>
#include <messages.h>
#include <reporthandler.h>
@@ -2006,10 +2007,7 @@ QString QtDocGenerator::functionSignature(const AbstractMetaClass* cppClass, con
QString QtDocGenerator::translateToPythonType(const AbstractMetaType* type, const AbstractMetaClass* cppClass)
{
- static const QStringList nativeTypes = {
- QLatin1String("bool"),
- QLatin1String("float"),
- QLatin1String("int"),
+ static const QStringList nativeTypes = {boolT(), floatT(), intT(),
QLatin1String("object"),
QLatin1String("str")
};
@@ -2022,14 +2020,14 @@ QString QtDocGenerator::translateToPythonType(const AbstractMetaType* type, cons
{ QLatin1String("QString"), QLatin1String("str") },
{ QLatin1String("uchar"), QLatin1String("str") },
{ QLatin1String("QStringList"), QLatin1String("list of strings") },
- { QLatin1String("QVariant"), QLatin1String("object") },
- { QLatin1String("quint32"), QLatin1String("int") },
- { QLatin1String("uint32_t"), QLatin1String("int") },
- { QLatin1String("quint64"), QLatin1String("int") },
- { QLatin1String("qint64"), QLatin1String("int") },
- { QLatin1String("size_t"), QLatin1String("int") },
- { QLatin1String("int64_t"), QLatin1String("int") },
- { QLatin1String("qreal"), QLatin1String("float") }
+ { qVariantT(), QLatin1String("object") },
+ { QLatin1String("quint32"), intT() },
+ { QLatin1String("uint32_t"), intT() },
+ { QLatin1String("quint64"), intT() },
+ { QLatin1String("qint64"), intT() },
+ { QLatin1String("size_t"), intT() },
+ { QLatin1String("int64_t"), intT() },
+ { QLatin1String("qreal"), floatT() }
};
const auto found = typeMap.find(name);
if (found != typeMap.end())
@@ -2038,10 +2036,10 @@ QString QtDocGenerator::translateToPythonType(const AbstractMetaType* type, cons
QString strType;
if (type->isConstant() && name == QLatin1String("char") && type->indirections() == 1) {
strType = QLatin1String("str");
- } else if (name.startsWith(QLatin1String("unsigned short"))) {
- strType = QLatin1String("int");
- } else if (name.startsWith(QLatin1String("unsigned "))) { // uint and ulong
- strType = QLatin1String("int");
+ } else if (name.startsWith(unsignedShortT())) {
+ strType = intT();
+ } else if (name.startsWith(unsignedT())) { // uint and ulong
+ strType = intT();
} else if (type->isContainer()) {
QString strType = translateType(type, cppClass, Options(ExcludeConst) | ExcludeReference);
strType.remove(QLatin1Char('*'));
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 6927229d9..5e6ad9b23 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -29,6 +29,7 @@
#include <memory>
#include "cppgenerator.h"
+#include "ctypenames.h"
#include "fileout.h"
#include "overloaddata.h"
#include <abstractmetalang.h>
@@ -150,16 +151,16 @@ CppGenerator::CppGenerator()
QLatin1String("PyObject*")});
m_sequenceProtocol.insert(QLatin1String("__setitem__"),
{QLatin1String("PyObject *self, Py_ssize_t _i, PyObject *_value"),
- QLatin1String("int")});
+ intT()});
m_sequenceProtocol.insert(QLatin1String("__getslice__"),
{QLatin1String("PyObject *self, Py_ssize_t _i1, Py_ssize_t _i2"),
QLatin1String("PyObject*")});
m_sequenceProtocol.insert(QLatin1String("__setslice__"),
{QLatin1String("PyObject *self, Py_ssize_t _i1, Py_ssize_t _i2, PyObject *_value"),
- QLatin1String("int")});
+ intT()});
m_sequenceProtocol.insert(QLatin1String("__contains__"),
{QLatin1String("PyObject *self, PyObject *_value"),
- QLatin1String("int")});
+ intT()});
m_sequenceProtocol.insert(QLatin1String("__concat__"),
{QLatin1String("PyObject *self, PyObject *_other"),
QLatin1String("PyObject*")});
@@ -182,7 +183,7 @@ CppGenerator::CppGenerator()
QLatin1String("PyObject*")});
m_mappingProtocol.insert(QLatin1String("__msetitem__"),
{QLatin1String("PyObject *self, PyObject *_key, PyObject *_value"),
- QLatin1String("int")});
+ intT()});
// Sequence protocol structure members names
m_mpFuncs.insert(QLatin1String("__mlen__"), QLatin1String("mp_length"));
@@ -5415,9 +5416,6 @@ void CppGenerator::writeSmartPointerSetattroFunction(QTextStream &s, const Gener
writeSetattroDefaultReturn(s);
}
-static inline QString qObjectClassName() { return QStringLiteral("QObject"); }
-static inline QString qMetaObjectClassName() { return QStringLiteral("QMetaObject"); }
-
void CppGenerator::writeGetattroDefinition(QTextStream &s, const AbstractMetaClass *metaClass)
{
s << "static PyObject *" << cpythonGetattroFunctionName(metaClass)
@@ -5428,7 +5426,7 @@ QString CppGenerator::qObjectGetAttroFunction() const
{
static QString result;
if (result.isEmpty()) {
- AbstractMetaClass *qobjectClass = AbstractMetaClass::findClass(classes(), qObjectClassName());
+ AbstractMetaClass *qobjectClass = AbstractMetaClass::findClass(classes(), qObjectT());
Q_ASSERT(qobjectClass);
result = QLatin1String("PySide::getMetaDataFromQObject(")
+ cpythonWrapperCPtr(qobjectClass, QLatin1String("self"))
@@ -5623,8 +5621,8 @@ bool CppGenerator::finishGeneration()
//We need move QMetaObject register before QObject
Dependencies additionalDependencies;
const AbstractMetaClassList &allClasses = classes();
- if (auto qObjectClass = AbstractMetaClass::findClass(allClasses, qObjectClassName())) {
- if (auto qMetaObjectClass = AbstractMetaClass::findClass(allClasses, qMetaObjectClassName())) {
+ if (auto qObjectClass = AbstractMetaClass::findClass(allClasses, qObjectT())) {
+ if (auto qMetaObjectClass = AbstractMetaClass::findClass(allClasses, qMetaObjectT())) {
Dependency dependency;
dependency.parent = qMetaObjectClass;
dependency.child = qObjectClass;
diff --git a/sources/shiboken2/generator/shiboken2/ctypenames.h b/sources/shiboken2/generator/shiboken2/ctypenames.h
new file mode 100644
index 000000000..abac261d5
--- /dev/null
+++ b/sources/shiboken2/generator/shiboken2/ctypenames.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CTYPENAMES_H
+#define CTYPENAMES_H
+
+#include <QtCore/QString>
+
+static inline QString boolT() { return QStringLiteral("bool"); }
+static inline QString intT() { return QStringLiteral("int"); }
+static inline QString unsignedT() { return QStringLiteral("unsigned"); }
+static inline QString unsignedIntT() { return QStringLiteral("unsigned int"); }
+static inline QString longT() { return QStringLiteral("long"); }
+static inline QString unsignedLongT() { return QStringLiteral("unsigned long"); }
+static inline QString shortT() { return QStringLiteral("short"); }
+static inline QString unsignedShortT() { return QStringLiteral("unsigned short"); }
+static inline QString unsignedCharT() { return QStringLiteral("unsigned char"); }
+static inline QString longLongT() { return QStringLiteral("long long"); }
+static inline QString unsignedLongLongT() { return QStringLiteral("unsigned long long"); }
+static inline QString charT() { return QStringLiteral("char"); }
+static inline QString floatT() { return QStringLiteral("float"); }
+static inline QString doubleT() { return QStringLiteral("double"); }
+static inline QString constCharPtrT() { return QStringLiteral("const char*"); }
+
+static inline QString qByteArrayT() { return QStringLiteral("QByteArray"); }
+static inline QString qMetaObjectT() { return QStringLiteral("QMetaObject"); }
+static inline QString qObjectT() { return QStringLiteral("QObject"); }
+static inline QString qStringT() { return QStringLiteral("QString"); }
+static inline QString qVariantT() { return QStringLiteral("QVariant"); }
+
+#endif // CTYPENAMES_H
diff --git a/sources/shiboken2/generator/shiboken2/overloaddata.cpp b/sources/shiboken2/generator/shiboken2/overloaddata.cpp
index bd39e9444..e70eeaea1 100644
--- a/sources/shiboken2/generator/shiboken2/overloaddata.cpp
+++ b/sources/shiboken2/generator/shiboken2/overloaddata.cpp
@@ -30,6 +30,7 @@
#include <reporthandler.h>
#include <graph.h>
#include "overloaddata.h"
+#include "ctypenames.h"
#include "indentor.h"
#include "shibokengenerator.h"
@@ -200,14 +201,10 @@ void OverloadData::sortNextOverloads()
// Primitive types that are not int, long, short,
// char and their respective unsigned counterparts.
- QStringList nonIntegerPrimitives;
- nonIntegerPrimitives << QLatin1String("float") << QLatin1String("double")
- << QLatin1String("bool");
+ static const QStringList nonIntegerPrimitives{floatT(), doubleT(), boolT()};
// Signed integer primitive types.
- QStringList signedIntegerPrimitives;
- signedIntegerPrimitives << QLatin1String("int") << QLatin1String("short")
- << QLatin1String("long");
+ static const QStringList signedIntegerPrimitives{intT(), shortT(), longT(), longLongT()};
// sort the children overloads
for (OverloadData *ov : qAsConst(m_nextOverloadData))
@@ -233,10 +230,10 @@ void OverloadData::sortNextOverloads()
} else if (!checkPyBuffer && typeName == QLatin1String("PyBuffer")) {
checkPyBuffer = true;
pyBufferIndex = sortData.lastProcessedItemId();
- } else if (!checkQVariant && typeName == QLatin1String("QVariant")) {
+ } else if (!checkQVariant && typeName == qVariantT()) {
checkQVariant = true;
qvariantIndex = sortData.lastProcessedItemId();
- } else if (!checkQString && typeName == QLatin1String("QString")) {
+ } else if (!checkQString && typeName == qStringT()) {
checkQString = true;
qstringIndex = sortData.lastProcessedItemId();
}
@@ -267,23 +264,16 @@ void OverloadData::sortNextOverloads()
// Create the graph of type dependencies based on implicit conversions.
Graph graph(sortData.reverseMap.count());
// All C++ primitive types, add any forgotten type AT THE END OF THIS LIST!
- const char *primitiveTypes[] = {"int",
- "unsigned int",
- "long",
- "unsigned long",
- "short",
- "unsigned short",
- "bool",
- "unsigned char",
- "char",
- "float",
- "double",
- "const char*"
- };
- const int numPrimitives = sizeof(primitiveTypes)/sizeof(const char *);
- bool hasPrimitive[numPrimitives];
- for (int i = 0; i < numPrimitives; ++i)
- hasPrimitive[i] = sortData.map.contains(QLatin1String(primitiveTypes[i]));
+ static const QStringList primitiveTypes{intT(), unsignedIntT(), longT(), unsignedLongT(),
+ shortT(), unsignedShortT(), boolT(), unsignedCharT(), charT(), floatT(),
+ doubleT(), constCharPtrT()};
+
+ QList<int> foundPrimitiveTypeIds;
+ for (const auto &p : primitiveTypes) {
+ const auto it = sortData.map.constFind(p);
+ if (it != sortData.map.cend())
+ foundPrimitiveTypeIds.append(it.value());
+ }
if (checkPySequence && checkPyObject)
graph.addEdge(pySeqIndex, pyobjectIndex);
@@ -306,7 +296,7 @@ void OverloadData::sortNextOverloads()
else
convertibleType = getTypeName(function->arguments().constFirst()->type());
- if (convertibleType == QLatin1String("int") || convertibleType == QLatin1String("unsigned int"))
+ if (convertibleType == intT() || convertibleType == unsignedIntT())
classesWithIntegerImplicitConversion << targetTypeEntryName;
if (!sortData.map.contains(convertibleType))
@@ -379,12 +369,12 @@ void OverloadData::sortNextOverloads()
// Add dependency on PyObject, so its check is the last one (too generic).
graph.addEdge(targetTypeId, pyobjectIndex);
}
- } else if (checkQVariant && targetTypeEntryName != QLatin1String("QVariant")) {
+ } else if (checkQVariant && targetTypeEntryName != qVariantT()) {
if (!graph.containsEdge(qvariantIndex, targetTypeId)) // Avoid cyclic dependency.
graph.addEdge(targetTypeId, qvariantIndex);
} else if (checkQString && ShibokenGenerator::isPointer(ov->argType())
- && targetTypeEntryName != QLatin1String("QString")
- && targetTypeEntryName != QLatin1String("QByteArray")
+ && targetTypeEntryName != qStringT()
+ && targetTypeEntryName != qByteArrayT()
&& (!checkPyObject || targetTypeId != pyobjectIndex)) {
if (!graph.containsEdge(qstringIndex, targetTypeId)) // Avoid cyclic dependency.
graph.addEdge(targetTypeId, qstringIndex);
@@ -392,16 +382,14 @@ void OverloadData::sortNextOverloads()
if (targetType->isEnum()) {
// Enum values must precede primitive types.
- for (int i = 0; i < numPrimitives; ++i) {
- if (hasPrimitive[i])
- graph.addEdge(targetTypeId, sortData.map[QLatin1String(primitiveTypes[i])]);
- }
+ for (auto id : foundPrimitiveTypeIds)
+ graph.addEdge(targetTypeId, id);
}
}
// QByteArray args need to be checked after QString args
- if (sortData.map.contains(QLatin1String("QString")) && sortData.map.contains(QLatin1String("QByteArray")))
- graph.addEdge(sortData.map[QLatin1String("QString")], sortData.map[QLatin1String("QByteArray")]);
+ if (sortData.map.contains(qStringT()) && sortData.map.contains(qByteArrayT()))
+ graph.addEdge(sortData.map.value(qStringT()), sortData.map.value(qByteArrayT()));
for (OverloadData *ov : qAsConst(m_nextOverloadData)) {
const AbstractMetaType *targetType = ov->argType();
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
index c82ef690c..418d3f529 100644
--- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
@@ -27,6 +27,7 @@
****************************************************************************/
#include "shibokengenerator.h"
+#include "ctypenames.h"
#include <abstractmetalang.h>
#include <messages.h>
#include "overloaddata.h"
@@ -195,8 +196,8 @@ void ShibokenGenerator::initPrimitiveTypesCorrespondences()
m_pythonPrimitiveTypeName.insert(QLatin1String(intType), QStringLiteral("PyInt"));
// PyFloat
- m_pythonPrimitiveTypeName.insert(QLatin1String("double"), QLatin1String("PyFloat"));
- m_pythonPrimitiveTypeName.insert(QLatin1String("float"), QLatin1String("PyFloat"));
+ m_pythonPrimitiveTypeName.insert(doubleT(), QLatin1String("PyFloat"));
+ m_pythonPrimitiveTypeName.insert(floatT(), QLatin1String("PyFloat"));
// PyLong
const char *longTypes[] = {
@@ -256,18 +257,18 @@ void ShibokenGenerator::initPrimitiveTypesCorrespondences()
m_formatUnits.clear();
m_formatUnits.insert(QLatin1String("char"), QLatin1String("b"));
m_formatUnits.insert(QLatin1String("unsigned char"), QLatin1String("B"));
- m_formatUnits.insert(QLatin1String("int"), QLatin1String("i"));
+ m_formatUnits.insert(intT(), QLatin1String("i"));
m_formatUnits.insert(QLatin1String("unsigned int"), QLatin1String("I"));
- m_formatUnits.insert(QLatin1String("short"), QLatin1String("h"));
- m_formatUnits.insert(QLatin1String("unsigned short"), QLatin1String("H"));
- m_formatUnits.insert(QLatin1String("long"), QLatin1String("l"));
- m_formatUnits.insert(QLatin1String("unsigned long"), QLatin1String("k"));
- m_formatUnits.insert(QLatin1String("long long"), QLatin1String("L"));
+ m_formatUnits.insert(shortT(), QLatin1String("h"));
+ m_formatUnits.insert(unsignedShortT(), QLatin1String("H"));
+ m_formatUnits.insert(longT(), QLatin1String("l"));
+ m_formatUnits.insert(unsignedLongLongT(), QLatin1String("k"));
+ m_formatUnits.insert(longLongT(), QLatin1String("L"));
m_formatUnits.insert(QLatin1String("__int64"), QLatin1String("L"));
- m_formatUnits.insert(QLatin1String("unsigned long long"), QLatin1String("K"));
+ m_formatUnits.insert(unsignedLongLongT(), QLatin1String("K"));
m_formatUnits.insert(QLatin1String("unsigned __int64"), QLatin1String("K"));
- m_formatUnits.insert(QLatin1String("double"), QLatin1String("d"));
- m_formatUnits.insert(QLatin1String("float"), QLatin1String("f"));
+ m_formatUnits.insert(doubleT(), QLatin1String("d"));
+ m_formatUnits.insert(floatT(), QLatin1String("f"));
}
void ShibokenGenerator::initKnownPythonTypes()
@@ -581,7 +582,7 @@ QString ShibokenGenerator::guessScopeForDefaultValue(const AbstractMetaFunction
const AbstractMetaClass *metaClass = AbstractMetaClass::findClass(classes(), arg->type()->typeEntry());
if (enumValueRegEx.match(value).hasMatch() && value != QLatin1String("NULL"))
prefix = resolveScopePrefix(metaClass, value);
- } else if (arg->type()->isPrimitive() && arg->type()->name() == QLatin1String("int")) {
+ } else if (arg->type()->isPrimitive() && arg->type()->name() == intT()) {
if (enumValueRegEx.match(value).hasMatch() && func->implementingClass())
prefix = resolveScopePrefix(func->implementingClass(), value);
} else if(arg->type()->isPrimitive()) {
@@ -2245,7 +2246,7 @@ ShibokenGenerator::AttroCheck ShibokenGenerator::checkAttroFunctionNeeds(const A
AbstractMetaClass::GetAttroFunction)) {
result |= AttroCheckFlag::GetattroUser;
}
- if (usePySideExtensions() && metaClass->qualifiedCppName() == QLatin1String("QObject"))
+ if (usePySideExtensions() && metaClass->qualifiedCppName() == qObjectT())
result |= AttroCheckFlag::SetattroQObject;
if (useOverrideCaching(metaClass))
result |= AttroCheckFlag::SetattroMethodOverride;
diff --git a/sources/shiboken2/libshiboken/basewrapper.h b/sources/shiboken2/libshiboken/basewrapper.h
index 267759daa..4fec74464 100644
--- a/sources/shiboken2/libshiboken/basewrapper.h
+++ b/sources/shiboken2/libshiboken/basewrapper.h
@@ -97,9 +97,6 @@ typedef void (*SubTypeInitHook)(SbkObjectType *, PyObject *, PyObject *);
typedef PyObject *(*SelectableFeatureHook)(PyTypeObject *);
LIBSHIBOKEN_API void initSelectableFeature(SelectableFeatureHook func);
-// PYSIDE-1019: Publish the start of setattro.
-LIBSHIBOKEN_API void SbkObject_NotifySetAttr(PyObject *obj, PyObject *name, PyObject *value);
-
// PYSIDE-1019: Get access to PySide reserved bits.
LIBSHIBOKEN_API int SbkObjectType_GetReserved(PyTypeObject *type);
LIBSHIBOKEN_API void SbkObjectType_SetReserved(PyTypeObject *type, int value);
diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/__feature__.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/__feature__.py
index 482d81017..3852b3463 100644
--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/__feature__.py
+++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/__feature__.py
@@ -175,9 +175,9 @@ def info(mod_name=None):
def _current_selection(flag):
names = []
if flag >= 0:
- for idx, name in enumerate(_really_all_feature_names):
- if (1 << idx) & flag:
- names.append(name)
+ for idx, name in enumerate(_really_all_feature_names):
+ if (1 << idx) & flag:
+ names.append(name)
return names
#eof
diff --git a/tools/create_changelog.py b/tools/create_changelog.py
index 7599cc6b9..8f5ea7ad0 100644
--- a/tools/create_changelog.py
+++ b/tools/create_changelog.py
@@ -145,7 +145,8 @@ def git_get_sha1s(versions: List[str], pattern: str):
command = "git rev-list --reverse --grep '^{}'".format(pattern)
command += " {}..{}".format(versions[0], versions[1])
command += " | git cat-file --batch"
- command += " | grep -o -E \"^[0-9a-f]{40}\""
+ command += " | grep -o -E \"^[0-9a-f]{40} commit\""
+ command += " | awk '{print $1}'"
print("{}: {}".format(git_command.__name__, command), file=sys.stderr)
out_sha1, err = Popen(command, stdout=PIPE, shell=True).communicate()
if err:
@@ -224,7 +225,9 @@ def create_change_log(versions: List[str]) -> None:
def gen_list(d: Dict[str, Dict[str, str]]) -> str:
- return "".join(" - [{}] {}\n".format(v["task"], v["title"])
+ def clean_task(s):
+ return s.replace("Fixes: ", "").replace("Task-number: ", "")
+ return "".join(" - [{}] {}\n".format(clean_task(v["task"]), v["title"])
for _, v in d.items())