aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/PySide2')
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qbytearray_bufferprotocol.cpp2
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qbytearray_mgetitem.cpp2
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp2
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h2
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp3
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qobject_findchild.cpp4
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml59
-rw-r--r--sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml2
-rw-r--r--sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp181
-rw-r--r--sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h6
-rw-r--r--sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp8
-rw-r--r--sources/pyside2/PySide2/QtQuick/pysidequickregistertype.h2
-rw-r--r--sources/pyside2/PySide2/QtScript/typesystem_script.xml7
-rw-r--r--sources/pyside2/PySide2/QtWidgets/glue/qmenu_glue.cpp6
-rw-r--r--sources/pyside2/PySide2/QtWidgets/glue/qmenubar_glue.cpp5
-rw-r--r--sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml20
-rw-r--r--sources/pyside2/PySide2/typesystem_templates.xml5
17 files changed, 147 insertions, 169 deletions
diff --git a/sources/pyside2/PySide2/QtCore/glue/qbytearray_bufferprotocol.cpp b/sources/pyside2/PySide2/QtCore/glue/qbytearray_bufferprotocol.cpp
index 22825a5cb..ed5fef3ae 100644
--- a/sources/pyside2/PySide2/QtCore/glue/qbytearray_bufferprotocol.cpp
+++ b/sources/pyside2/PySide2/QtCore/glue/qbytearray_bufferprotocol.cpp
@@ -47,7 +47,7 @@ extern "C" {
static Py_ssize_t SbkQByteArray_segcountproc(PyObject* self, Py_ssize_t* lenp)
{
if (lenp)
- *lenp = self->ob_type->tp_as_sequence->sq_length(self);
+ *lenp = Py_TYPE(self)->tp_as_sequence->sq_length(self);
return 1;
}
diff --git a/sources/pyside2/PySide2/QtCore/glue/qbytearray_mgetitem.cpp b/sources/pyside2/PySide2/QtCore/glue/qbytearray_mgetitem.cpp
index 6a997c852..f1d5a6bfc 100644
--- a/sources/pyside2/PySide2/QtCore/glue/qbytearray_mgetitem.cpp
+++ b/sources/pyside2/PySide2/QtCore/glue/qbytearray_mgetitem.cpp
@@ -82,6 +82,6 @@ if (PyIndex_Check(_key)) {
} else {
PyErr_Format(PyExc_TypeError,
"list indices must be integers or slices, not %.200s",
- _key->ob_type->tp_name);
+ PepType((Py_TYPE(_key)))->tp_name);
return NULL;
}
diff --git a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp
index 5d28fbf41..46a69be31 100644
--- a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp
+++ b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include <Python.h>
+#include <sbkpython.h>
#include <shiboken.h>
#include <pysideweakref.h>
#include <QEasingCurve>
diff --git a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h
index 7053d808c..358ea9eec 100644
--- a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h
+++ b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h
@@ -40,7 +40,7 @@
#ifndef __QEASINGCURVE_GLUE__
#define __QEASINGCURVE_GLUE__
-#include <Python.h>
+#include <sbkpython.h>
#include <QEasingCurve>
class PySideEasingCurveFunctor
diff --git a/sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp b/sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp
index ed37cef34..20f3720bf 100644
--- a/sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp
+++ b/sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp
@@ -43,8 +43,7 @@ static bool isDecorator(PyObject* method, PyObject* self)
if (!PyObject_HasAttr(self, methodName))
return true;
Shiboken::AutoDecRef otherMethod(PyObject_GetAttr(self, methodName));
- return reinterpret_cast<PyMethodObject*>(otherMethod.object())->im_func != \
- reinterpret_cast<PyMethodObject*>(method)->im_func;
+ return PyMethod_GET_FUNCTION(otherMethod.object()) != PyMethod_GET_FUNCTION(method);
}
static bool getReceiver(QObject *source, const char* signal, PyObject* callback, QObject** receiver, PyObject** self, QByteArray* callbackSig)
diff --git a/sources/pyside2/PySide2/QtCore/glue/qobject_findchild.cpp b/sources/pyside2/PySide2/QtCore/glue/qobject_findchild.cpp
index 464fb68b1..b32d104fd 100644
--- a/sources/pyside2/PySide2/QtCore/glue/qobject_findchild.cpp
+++ b/sources/pyside2/PySide2/QtCore/glue/qobject_findchild.cpp
@@ -41,7 +41,7 @@ static QObject* _findChildHelper(const QObject* parent, const QString& name, PyT
{
foreach(QObject* child, parent->children()) {
Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject*](child));
- if (PyType_IsSubtype(pyChild->ob_type, desiredType)
+ if (PyType_IsSubtype(Py_TYPE(pyChild), desiredType)
&& (name.isNull() || name == child->objectName())) {
return child;
}
@@ -71,7 +71,7 @@ static void _findChildrenHelper(const QObject* parent, const T& name, PyTypeObje
{
foreach(const QObject* child, parent->children()) {
Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject*](child));
- if (PyType_IsSubtype(pyChild->ob_type, desiredType) && _findChildrenComparator(child, name))
+ if (PyType_IsSubtype(Py_TYPE(pyChild), desiredType) && _findChildrenComparator(child, name))
PyList_Append(result, pyChild);
_findChildrenHelper(child, name, desiredType, result);
}
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index f0b6b9640..63c3d50ea 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -291,12 +291,18 @@
</native-to-target>
<target-to-native>
<add-conversion type="PyUnicode">
- Py_UNICODE *unicode = PyUnicode_AS_UNICODE(%in);
- #if defined(Py_UNICODE_WIDE)
+ #ifndef Py_LIMITED_API
+ Py_UNICODE* unicode = PyUnicode_AS_UNICODE(%in);
+ # if defined(Py_UNICODE_WIDE)
// cast as Py_UNICODE can be a different type
%out = QString::fromUcs4((const uint*)unicode);
- #else
+ # else
%out = QString::fromUtf16((const ushort*)unicode, PyUnicode_GET_SIZE(%in));
+ # endif
+ #else
+ wchar_t *temp = PyUnicode_AsWideCharString(%in, NULL);
+ %out = QString::fromWCharArray(temp);
+ PyMem_Free(temp);
#endif
</add-conversion>
<add-conversion type="PyString" check="py2kStrCheck(%in)">
@@ -410,7 +416,7 @@
<add-conversion type="SbkObject">
// a class supported by QVariant?
int typeCode;
- const char *typeName = QVariant_resolveMetaType(%in->ob_type, &amp;typeCode);
+ const char *typeName = QVariant_resolveMetaType(Py_TYPE(%in), &amp;typeCode);
if (!typeCode || !typeName)
return;
QVariant var(typeCode, (void*)0);
@@ -435,9 +441,9 @@
<inject-code class="native" position="beginning">
static const char *QVariant_resolveMetaType(PyTypeObject *type, int *typeId)
{
- if (PyObject_TypeCheck(type, &amp;SbkObjectType_Type)) {
- SbkObjectType *sbkType = (SbkObjectType*)type;
- const char *typeName = Shiboken::ObjectType::getOriginalName(sbkType);
+ if (PyObject_TypeCheck(type, SbkObjectType_TypeF())) {
+ SbkObjectType* sbkType = (SbkObjectType*)type;
+ const char* typeName = Shiboken::ObjectType::getOriginalName(sbkType);
if (!typeName)
return 0;
bool valueType = '*' != typeName[qstrlen(typeName) - 1];
@@ -456,15 +462,16 @@
// tp_base does not always point to the first base class, but rather to the first
// that has added any python fields or slots to its object layout.
// See https://mail.python.org/pipermail/python-list/2009-January/520733.html
- if (type->tp_bases) {
- for (int i = 0; i &lt; PyTuple_GET_SIZE(type->tp_bases); ++i) {
- const char *derivedName = QVariant_resolveMetaType((PyTypeObject*)PyTuple_GET_ITEM(type->tp_bases, i), typeId);
+ if (PepType(type)->tp_bases) {
+ for (int i = 0; i &lt; PyTuple_GET_SIZE(PepType(type)->tp_bases); ++i) {
+ const char *derivedName = QVariant_resolveMetaType((PyTypeObject*)PyTuple_GET_ITEM(
+ PepType(type)->tp_bases, i), typeId);
if (derivedName)
return derivedName;
}
}
- else if (type->tp_base) {
- return QVariant_resolveMetaType(type->tp_base, typeId);
+ else if (PepType(type)->tp_base) {
+ return QVariant_resolveMetaType(PepType(type)->tp_base, typeId);
}
}
*typeId = 0;
@@ -563,16 +570,16 @@
</add-conversion>
<add-conversion type="PyTypeObject">
const char *typeName;
- if (Shiboken::String::checkType((PyTypeObject*)%in))
+ if (Shiboken::String::checkType(reinterpret_cast&lt;PyTypeObject*&gt;(%in)))
typeName = "QString";
else if (%in == reinterpret_cast&lt;PyObject*&gt;(&amp;PyFloat_Type))
typeName = "double"; // float is a UserType in QVariant.
else if (%in == reinterpret_cast&lt;PyObject*&gt;(&amp;PyLong_Type))
typeName = "int"; // long is a UserType in QVariant.
- else if (%in->ob_type == &amp;SbkObjectType_Type)
+ else if (Py_TYPE(%in) == SbkObjectType_TypeF())
typeName = Shiboken::ObjectType::getOriginalName((SbkObjectType*)%in);
else
- typeName = (reinterpret_cast&lt;PyTypeObject*&gt;(%in))->tp_name;
+ typeName = PepType((reinterpret_cast&lt;PyTypeObject*&gt;(%in)))->tp_name;
%out = QVariant::nameToType(typeName);
</add-conversion>
<add-conversion type="PyString" check="Shiboken::String::check(%in)">
@@ -2589,7 +2596,7 @@
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
- QByteArray b((reinterpret_cast&lt;PyObject*&gt;(%PYSELF))->ob_type->tp_name);
+ QByteArray b(PepType(Py_TYPE(%PYSELF))->tp_name);
PyObject *aux = Shiboken::String::fromStringAndSize(%CPPSELF.constData(), %CPPSELF.size());
if (PyUnicode_CheckExact(aux)) {
PyObject *tmp = PyUnicode_AsASCIIString(aux);
@@ -3088,7 +3095,7 @@
<inject-code>
Py_ssize_t size;
uchar *ptr = reinterpret_cast&lt;uchar*&gt;(Shiboken::Buffer::getPointer(%PYARG_1, &amp;size));
- %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(const_cast&lt;const uchar*>(ptr), size);
+ %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(const_cast&lt;const uchar*&gt;(ptr), size);
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
</inject-code>
</modify-function>
@@ -3114,8 +3121,8 @@
// %FUNCTION_NAME() - disable generation of c++ function call
(void) %2; // remove warning about unused variable
Shiboken::AutoDecRef emptyTuple(PyTuple_New(0));
- PyObject *pyTimer = Shiboken::SbkType&lt;QTimer>()->tp_new(Shiboken::SbkType&lt;QTimer>(), emptyTuple, 0);
- Shiboken::SbkType&lt;QTimer>()->tp_init(pyTimer, emptyTuple, 0);
+ PyObject *pyTimer = PepType(Shiboken::SbkType&lt;QTimer&gt;())->tp_new(Shiboken::SbkType&lt;QTimer&gt;(), emptyTuple, 0);
+ PepType(Shiboken::SbkType&lt;QTimer&gt;())->tp_init(pyTimer, emptyTuple, 0);
QTimer* timer = %CONVERTTOCPP[QTimer*](pyTimer);
Shiboken::AutoDecRef result(
@@ -3138,14 +3145,14 @@
<inject-code class="target" position="beginning">
// %FUNCTION_NAME() - disable generation of c++ function call
Shiboken::AutoDecRef emptyTuple(PyTuple_New(0));
- PyObject *pyTimer = Shiboken::SbkType&lt;QTimer>()->tp_new(Shiboken::SbkType&lt;QTimer>(), emptyTuple, 0);
- Shiboken::SbkType&lt;QTimer>()->tp_init(pyTimer, emptyTuple, 0);
+ PyObject *pyTimer = PepType(Shiboken::SbkType&lt;QTimer&gt;())->tp_new(Shiboken::SbkType&lt;QTimer&gt;(), emptyTuple, 0);
+ PepType(Shiboken::SbkType&lt;QTimer&gt;())->tp_init(pyTimer, emptyTuple, 0);
QTimer* timer = %CONVERTTOCPP[QTimer*](pyTimer);
timer->setSingleShot(true);
- if (PyObject_TypeCheck(%2, &amp;PySideSignalInstanceType)) {
+ if (PyObject_TypeCheck(%2, PySideSignalInstanceTypeF())) {
PySideSignalInstance *signalInstance = reinterpret_cast&lt;PySideSignalInstance*&gt;(%2);
- Shiboken::AutoDecRef signalSignature(Shiboken::String::fromFormat("2%s",PySide::Signal::getSignature(signalInstance)));
+ Shiboken::AutoDecRef signalSignature(Shiboken::String::fromFormat("2%s", PySide::Signal::getSignature(signalInstance)));
Shiboken::AutoDecRef result(
PyObject_CallMethod(pyTimer,
const_cast&lt;char*&gt;("connect"),
@@ -4026,7 +4033,7 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
<replace-default-expression with="0" />
</modify-argument>
<inject-code>
- if (PyObject_TypeCheck(%1, &amp;PySideSignalInstanceType)) {
+ if (PyObject_TypeCheck(%1, PySideSignalInstanceTypeF())) {
PyObject *dataSource = PySide::Signal::getObject((PySideSignalInstance*)%PYARG_1);
Shiboken::AutoDecRef obType(PyObject_Type(dataSource));
QObject* sender = %CONVERTTOCPP[QObject*](dataSource);
@@ -4082,11 +4089,11 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
// since it refers to a name very tied to the generator implementation.
// Check bug #362 for more information on this
// http://bugs.openbossa.org/show_bug.cgi?id=362
- if (!PyObject_TypeCheck(%1, &amp;PySideSignalInstanceType))
+ if (!PyObject_TypeCheck(%1, PySideSignalInstanceTypeF()))
goto Sbk_%TYPEFunc_%FUNCTION_NAME_TypeError;
PySideSignalInstance *signalInstance = reinterpret_cast&lt;PySideSignalInstance*&gt;(%1);
QObject* sender = %CONVERTTOCPP[QObject*](PySide::Signal::getObject(signalInstance));
- QSignalTransition*%0 = %CPPSELF->%FUNCTION_NAME(sender,PySide::Signal::getSignature(signalInstance),%2);
+ QSignalTransition *%0 = %CPPSELF->%FUNCTION_NAME(sender, PySide::Signal::getSignature(signalInstance),%2);
%PYARG_0 = %CONVERTTOPYTHON[QSignalTransition*](%0);
</inject-code>
</add-function>
diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
index 47bf62992..eee22b55c 100644
--- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
+++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
@@ -1752,7 +1752,7 @@
PyErr_Format(PyExc_TypeError, "Invalid return value in function %s, expected %s, got %s.",
"QValidator.validate",
"PySide2.QtGui.QValidator.State, (PySide2.QtGui.QValidator.State,), (PySide2.QtGui.QValidator.State, unicode) or (PySide2.QtGui.QValidator.State, unicode, int)",
- pyResult->ob_type->tp_name);
+ PepType((Py_TYPE(pyResult)))->tp_name);
return QValidator::State();
}
</template>
diff --git a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp
index d95ae2259..fa9eb6349 100644
--- a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp
+++ b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp
@@ -120,9 +120,9 @@ int PySide::qmlRegisterType(PyObject *pyObj, const char *uri, int versionMajor,
}
PyTypeObject *pyObjType = reinterpret_cast<PyTypeObject *>(pyObj);
- if (!PySequence_Contains(pyObjType->tp_mro, reinterpret_cast<PyObject *>(qobjectType))) {
+ if (!PySequence_Contains(PepType(pyObjType)->tp_mro, reinterpret_cast<PyObject *>(qobjectType))) {
PyErr_Format(PyExc_TypeError, "A type inherited from %s expected, got %s.",
- qobjectType->tp_name, pyObjType->tp_name);
+ PepType(qobjectType)->tp_name, PepType(pyObjType)->tp_name);
return -1;
}
@@ -229,57 +229,34 @@ void propListTpFree(void* self)
PySideProperty* pySelf = reinterpret_cast<PySideProperty*>(self);
delete reinterpret_cast<QmlListProperty*>(PySide::Property::userData(pySelf));
// calls base type constructor
- Py_TYPE(pySelf)->tp_base->tp_free(self);
+ PepType(PepType(Py_TYPE(pySelf))->tp_base)->tp_free(self);
}
-PyTypeObject PropertyListType = {
- PyVarObject_HEAD_INIT(0, 0)
- "ListProperty", /*tp_name*/
- sizeof(PySideProperty), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- 0, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- 0, /*tp_doc */
- 0, /*tp_traverse */
- 0, /*tp_clear */
- 0, /*tp_richcompare */
- 0, /*tp_weaklistoffset */
- 0, /*tp_iter */
- 0, /*tp_iternext */
- 0, /*tp_methods */
- 0, /*tp_members */
- 0, /*tp_getset */
- &PySidePropertyType, /*tp_base */
- 0, /*tp_dict */
- 0, /*tp_descr_get */
- 0, /*tp_descr_set */
- 0, /*tp_dictoffset */
- propListTpInit, /*tp_init */
- 0, /*tp_alloc */
- 0, /*tp_new */
- propListTpFree, /*tp_free */
- 0, /*tp_is_gc */
- 0, /*tp_bases */
- 0, /*tp_mro */
- 0, /*tp_cache */
- 0, /*tp_subclasses */
- 0, /*tp_weaklist */
- 0, /*tp_del */
+static PyType_Slot PropertyListType_slots[] = {
+ {Py_tp_init, (void *)propListTpInit},
+ {Py_tp_free, (void *)propListTpFree},
+ {Py_tp_dealloc, (void *)SbkDummyDealloc},
+ {0, 0}
};
+static PyType_Spec PropertyListType_spec = {
+ "PySide2.QtQml.ListProperty",
+ sizeof(PySideProperty),
+ 0,
+ Py_TPFLAGS_DEFAULT,
+ PropertyListType_slots,
+};
+
+
+PyTypeObject *PropertyListTypeF(void)
+{
+ static PyTypeObject *type = nullptr;
+ if (!type) {
+ PyObject *bases = Py_BuildValue("(O)", PySidePropertyTypeF());
+ type = (PyTypeObject *)PyType_FromSpecWithBases(&PropertyListType_spec, bases);
+ Py_XDECREF(bases);
+ }
+ return type;
+}
} // extern "C"
@@ -312,7 +289,7 @@ int propListCount(QQmlListProperty<QObject> *propList)
// Check return type
int cppResult = 0;
- PythonToCppFunc pythonToCpp;
+ PythonToCppFunc pythonToCpp = 0;
if (PyErr_Occurred())
PyErr_Print();
else if ((pythonToCpp = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter<int>(), retVal)))
@@ -387,7 +364,7 @@ QtQml_VolatileBoolObject_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return Q_NULLPTR;
QtQml_VolatileBoolObject *self
- = reinterpret_cast<QtQml_VolatileBoolObject *>(type->tp_alloc(type, 0));
+ = reinterpret_cast<QtQml_VolatileBoolObject *>(PepType(type)->tp_alloc(type, 0));
if (self != Q_NULLPTR)
self->flag = ok;
@@ -444,10 +421,10 @@ QtQml_VolatileBoolObject_repr(QtQml_VolatileBoolObject *self)
if (self->flag)
s = PyBytes_FromFormat("%s(True)",
- Py_TYPE(self)->tp_name);
+ PepType((Py_TYPE(self)))->tp_name);
else
s = PyBytes_FromFormat("%s(False)",
- Py_TYPE(self)->tp_name);
+ PepType((Py_TYPE(self)))->tp_name);
Py_XINCREF(s);
return s;
}
@@ -459,87 +436,61 @@ QtQml_VolatileBoolObject_str(QtQml_VolatileBoolObject *self)
if (self->flag)
s = PyBytes_FromFormat("%s(True) -> %p",
- Py_TYPE(self)->tp_name, &(self->flag));
+ PepType((Py_TYPE(self)))->tp_name, &(self->flag));
else
s = PyBytes_FromFormat("%s(False) -> %p",
- Py_TYPE(self)->tp_name, &(self->flag));
+ PepType((Py_TYPE(self)))->tp_name, &(self->flag));
Py_XINCREF(s);
return s;
}
-PyTypeObject QtQml_VolatileBoolType = {
- PyVarObject_HEAD_INIT(Q_NULLPTR, 0) /*ob_size*/
- "VolatileBool", /*tp_name*/
- sizeof(QtQml_VolatileBoolObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- 0, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- reinterpret_cast<reprfunc>(QtQml_VolatileBoolObject_repr), /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- reinterpret_cast<reprfunc>(QtQml_VolatileBoolObject_str), /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "VolatileBool objects contain a C++ volatile bool", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- QtQml_VolatileBoolObject_methods, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
- QtQml_VolatileBoolObject_new, /* tp_new */
- 0, /* tp_free */
- 0, /* tp_is_gc */
- 0, /* tp_bases */
- 0, /* tp_mro */
- 0, /* tp_cache */
- 0, /* tp_subclasses */
- 0, /* tp_weaklist */
- 0, /* tp_del */
- 0, /* tp_version_tag */
-#if PY_MAJOR_VERSION > 3 || PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 4
- 0 /* tp_finalize */
-#endif
+static PyType_Slot QtQml_VolatileBoolType_slots[] = {
+ {Py_tp_repr, (void *)reinterpret_cast<reprfunc>(QtQml_VolatileBoolObject_repr)},
+ {Py_tp_str, (void *)reinterpret_cast<reprfunc>(QtQml_VolatileBoolObject_str)},
+ {Py_tp_methods, (void *)QtQml_VolatileBoolObject_methods},
+ {Py_tp_new, (void *)QtQml_VolatileBoolObject_new},
+ {Py_tp_dealloc, (void *)SbkDummyDealloc},
+ {0, 0}
};
+static PyType_Spec QtQml_VolatileBoolType_spec = {
+ "PySide2.QtQml.VolatileBool",
+ sizeof(QtQml_VolatileBoolObject),
+ 0,
+ Py_TPFLAGS_DEFAULT,
+ QtQml_VolatileBoolType_slots,
+};
+
+
+PyTypeObject *QtQml_VolatileBoolTypeF(void)
+{
+ static PyTypeObject *type = nullptr;
+ if (!type)
+ type = (PyTypeObject *)PyType_FromSpec(&QtQml_VolatileBoolType_spec);
+ return type;
+}
void PySide::initQmlSupport(PyObject* module)
{
ElementFactory<PYSIDE_MAX_QML_TYPES - 1>::init();
// Export QmlListProperty type
- if (PyType_Ready(&PropertyListType) < 0) {
+ if (PyType_Ready(PropertyListTypeF()) < 0) {
+ PyErr_Print();
qWarning() << "Error initializing PropertyList type.";
return;
}
- Py_INCREF(reinterpret_cast<PyObject *>(&PropertyListType));
- PyModule_AddObject(module, PropertyListType.tp_name,
- reinterpret_cast<PyObject *>(&PropertyListType));
+ Py_INCREF(reinterpret_cast<PyObject *>(PropertyListTypeF()));
+ PyModule_AddObject(module, PepType_GetNameStr(PropertyListTypeF()),
+ reinterpret_cast<PyObject *>(PropertyListTypeF()));
- if (PyType_Ready(&QtQml_VolatileBoolType) < 0) {
+ if (PyType_Ready(QtQml_VolatileBoolTypeF()) < 0) {
+ PyErr_Print();
qWarning() << "Error initializing VolatileBool type.";
return;
}
- Py_INCREF(&QtQml_VolatileBoolType);
- PyModule_AddObject(module, QtQml_VolatileBoolType.tp_name,
- reinterpret_cast<PyObject *>(&QtQml_VolatileBoolType));
+ Py_INCREF(QtQml_VolatileBoolTypeF());
+ PyModule_AddObject(module, PepType_GetNameStr(QtQml_VolatileBoolTypeF()),
+ reinterpret_cast<PyObject *>(QtQml_VolatileBoolTypeF()));
}
diff --git a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h
index a4ee7309a..0ef6539a5 100644
--- a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h
+++ b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h
@@ -40,7 +40,7 @@
#ifndef PYSIDEQMLREGISTERTYPE_H
#define PYSIDEQMLREGISTERTYPE_H
-#include <Python.h>
+#include <sbkpython.h>
struct SbkObjectType;
@@ -78,8 +78,8 @@ typedef struct {
volatile bool flag;
} QtQml_VolatileBoolObject;
-PyAPI_DATA(PyTypeObject) QtQml_VolatileBoolType;
+PyAPI_FUNC(PyTypeObject *) QtQml_VolatileBoolTypeF(void);
-#define VolatileBool_Check(op) (Py_TYPE(op) == &QtQml_VolatileBoolType)
+#define VolatileBool_Check(op) (Py_TYPE(op) == QtQml_VolatileBoolTypeF())
#endif
diff --git a/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp b/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
index 594fa8015..67ef53551 100644
--- a/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
+++ b/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
@@ -106,11 +106,11 @@ struct ElementFactory<0> : ElementFactoryBase<0>
typePointerName, typeListName, \
typeMetaObject, type, registered)
-bool pyTypeObjectInheritsFromClass(const PyTypeObject *pyObjType, QByteArray className)
+bool pyTypeObjectInheritsFromClass(PyTypeObject *pyObjType, QByteArray className)
{
className.append('*');
PyTypeObject *classPyType = Shiboken::Conversions::getPythonTypeObject(className.constData());
- bool isDerived = PySequence_Contains(pyObjType->tp_mro,
+ bool isDerived = PySequence_Contains(PepType(pyObjType)->tp_mro,
reinterpret_cast<PyObject *>(classPyType));
return isDerived;
}
@@ -118,7 +118,7 @@ bool pyTypeObjectInheritsFromClass(const PyTypeObject *pyObjType, QByteArray cla
template <class WrapperClass>
void registerTypeIfInheritsFromClass(
QByteArray className,
- const PyTypeObject *typeToRegister,
+ PyTypeObject *typeToRegister,
const QByteArray &typePointerName,
const QByteArray &typeListName,
QMetaObject *typeMetaObject,
@@ -190,7 +190,7 @@ bool quickRegisterType(PyObject *pyObj, const char *uri, int versionMajor, int v
PyTypeObject *pyObjType = reinterpret_cast<PyTypeObject *>(pyObj);
PyTypeObject *qQuickItemPyType =
Shiboken::Conversions::getPythonTypeObject("QQuickItem*");
- bool isQuickItem = PySequence_Contains(pyObjType->tp_mro,
+ bool isQuickItem = PySequence_Contains(PepType(pyObjType)->tp_mro,
reinterpret_cast<PyObject *>(qQuickItemPyType));
// Register only classes that inherit QQuickItem or its children.
diff --git a/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.h b/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.h
index 35d3edecb..1955413b2 100644
--- a/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.h
+++ b/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.h
@@ -40,7 +40,7 @@
#ifndef PYSIDE_QUICK_REGISTER_TYPE_H
#define PYSIDE_QUICK_REGISTER_TYPE_H
-#include <Python.h>
+#include <sbkpython.h>
struct SbkObjectType;
diff --git a/sources/pyside2/PySide2/QtScript/typesystem_script.xml b/sources/pyside2/PySide2/QtScript/typesystem_script.xml
index ccb2e3ab7..dc089a300 100644
--- a/sources/pyside2/PySide2/QtScript/typesystem_script.xml
+++ b/sources/pyside2/PySide2/QtScript/typesystem_script.xml
@@ -84,11 +84,12 @@
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
if (%CPPSELF.isVariant() || %CPPSELF.isString()) {
- QString format = QString().sprintf("%s(\"%s\")", ((PyObject*)%PYSELF)->ob_type->tp_name, qPrintable(%CPPSELF.toString()));
+ QString format = QString().sprintf("%s(\"%s\")",
+ PepType(Py_TYPE(%PYSELF))->tp_name,
+ qPrintable(%CPPSELF.toString()));
%PYARG_0 = Shiboken::String::fromCString(qPrintable(format));
} else {
- %PYARG_0 = Shiboken::String::fromCString(
- ((PyObject* )%PYSELF)->ob_type->tp_name);
+ %PYARG_0 = Shiboken::String::fromCString(PepType(Py_TYPE(%PYSELF))->tp_name);
}
</inject-code>
</add-function>
diff --git a/sources/pyside2/PySide2/QtWidgets/glue/qmenu_glue.cpp b/sources/pyside2/PySide2/QtWidgets/glue/qmenu_glue.cpp
index 8a4b7e628..4e9c8c3b7 100644
--- a/sources/pyside2/PySide2/QtWidgets/glue/qmenu_glue.cpp
+++ b/sources/pyside2/PySide2/QtWidgets/glue/qmenu_glue.cpp
@@ -50,7 +50,11 @@ inline PyObject* addActionWithPyObject(QMenu* self, const QIcon& icon, const QSt
self->addAction(act);
PyObject* pyAct = %CONVERTTOPYTHON[QAction*](act);
- Shiboken::AutoDecRef result(PyObject_CallMethod(pyAct, "connect", "OsO", pyAct, SIGNAL(triggered()), callback));
+ Shiboken::AutoDecRef result(PyObject_CallMethod(pyAct,
+ const_cast<char *>("connect"),
+ const_cast<char *>("OsO"),
+ pyAct,
+ SIGNAL(triggered()), callback));
if (result.isNull()) {
Py_DECREF(pyAct);
return 0;
diff --git a/sources/pyside2/PySide2/QtWidgets/glue/qmenubar_glue.cpp b/sources/pyside2/PySide2/QtWidgets/glue/qmenubar_glue.cpp
index fdd621128..8cdbc2e01 100644
--- a/sources/pyside2/PySide2/QtWidgets/glue/qmenubar_glue.cpp
+++ b/sources/pyside2/PySide2/QtWidgets/glue/qmenubar_glue.cpp
@@ -45,7 +45,10 @@ addActionWithPyObject(QMenuBar* self, const QString& text, PyObject* callback)
self->addAction(act);
PyObject* pyAct = %CONVERTTOPYTHON[QAction*](act);
- PyObject* result = PyObject_CallMethod(pyAct, "connect", "OsO", pyAct,
+ PyObject* result = PyObject_CallMethod(pyAct,
+ const_cast<char *>("connect"),
+ const_cast<char *>("OsO"),
+ pyAct,
SIGNAL(triggered(bool)), callback);
if (result == 0 || result == Py_False) {
diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
index b4a6c2453..11e6a9f7a 100644
--- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
+++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
@@ -269,7 +269,7 @@
<enum-type name="PanelModality" since="4.6"/>
<inject-code class="target" position="end">
PyObject *userTypeConstant = PyInt_FromLong(QGraphicsItem::UserType);
- PyDict_SetItemString(Sbk_QGraphicsItem_Type.super.ht_type.tp_dict, "UserType", userTypeConstant);
+ PyDict_SetItemString(PepType(Sbk_QGraphicsItem_TypeF())->tp_dict, "UserType", userTypeConstant);
</inject-code>
<modify-function signature="setParentItem(QGraphicsItem*)">
<modify-argument index="this">
@@ -1022,7 +1022,11 @@
%0 = new %TYPE(%1, %2);
</inject-code>
<inject-code class="target" position="end">
- Shiboken::AutoDecRef result(PyObject_CallMethod(%PYSELF, "connect", "OsO", %PYSELF, SIGNAL(activated()), %PYARG_3));
+ Shiboken::AutoDecRef result(PyObject_CallMethod(%PYSELF,
+ const_cast&lt;char *&gt;("connect"),
+ const_cast&lt;char *&gt;("OsO"),
+ %PYSELF, SIGNAL(activated()), %PYARG_3)
+ );
if (!result.isNull())
Shiboken::Object::setParent(%PYARG_2, %PYSELF);
</inject-code>
@@ -3029,7 +3033,11 @@
<inject-code>
QAction *action = %CPPSELF.addAction(%1, %2);
%PYARG_0 = %CONVERTTOPYTHON[QAction*](action);
- Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0, "connect", "OsO", %PYARG_0, SIGNAL(triggered()), %PYARG_3));
+ Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0,
+ const_cast&lt;char *&gt;("connect"),
+ const_cast&lt;char *&gt;("OsO"),
+ %PYARG_0, SIGNAL(triggered()), %PYARG_3)
+ );
</inject-code>
</modify-function>
<modify-function signature="addAction(QString,const QObject*,const char*)">
@@ -3045,7 +3053,11 @@
<inject-code>
QAction *action = %CPPSELF.addAction(%1);
%PYARG_0 = %CONVERTTOPYTHON[QAction*](action);
- Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0, "connect", "OsO", %PYARG_0, SIGNAL(triggered()), %PYARG_2));
+ Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0,
+ const_cast&lt;char *&gt;("connect"),
+ const_cast&lt;char *&gt;("OsO"),
+ %PYARG_0, SIGNAL(triggered()), %PYARG_2)
+ );
</inject-code>
</modify-function>
<modify-function signature="addAction(const QString&amp;)">
diff --git a/sources/pyside2/PySide2/typesystem_templates.xml b/sources/pyside2/PySide2/typesystem_templates.xml
index 798d02ddb..103d773cf 100644
--- a/sources/pyside2/PySide2/typesystem_templates.xml
+++ b/sources/pyside2/PySide2/typesystem_templates.xml
@@ -314,11 +314,12 @@
<!-- templates for __repr__ -->
<template name="repr_code">
- QString format = QString().sprintf("%s(%REPR_FORMAT)", ((PyObject*)%PYSELF)->ob_type->tp_name, %REPR_ARGS);
+ QString format = QString().sprintf("%s(%REPR_FORMAT)",
+ PepType(Py_TYPE(%PYSELF))->tp_name, %REPR_ARGS);
%PYARG_0 = Shiboken::String::fromCString(qPrintable(format));
</template>
<template name="repr_code_matrix">
- QString format= QString("%1((").arg(((PyObject*)%PYSELF)->ob_type->tp_name);
+ QString format= QString("%1((").arg(PepType(Py_TYPE(%PYSELF))->tp_name);
QList&lt; %MATRIX_TYPE &gt; cppArgs;
%MATRIX_TYPE data[%MATRIX_SIZE];