aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qbytearray_mgetitem.cpp2
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qbytearray_msetitem.cpp10
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml26
-rw-r--r--sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml2
-rw-r--r--sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp16
-rw-r--r--sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp4
-rw-r--r--sources/pyside2/PySide2/QtScript/typesystem_script.xml4
-rw-r--r--sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml2
-rw-r--r--sources/pyside2/PySide2/typesystem_templates.xml4
-rw-r--r--sources/pyside2/libpyside/dynamicqmetaobject.cpp8
-rw-r--r--sources/pyside2/libpyside/pyside.cpp4
-rw-r--r--sources/pyside2/libpyside/pysideclassinfo.cpp4
-rw-r--r--sources/pyside2/libpyside/pysideproperty.cpp8
-rw-r--r--sources/pyside2/libpyside/pysideqflags.cpp2
-rw-r--r--sources/pyside2/libpyside/pysidesignal.cpp14
-rw-r--r--sources/pyside2/libpyside/pysideslot.cpp2
-rw-r--r--sources/pyside2/plugins/customwidget.cpp2
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp24
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.cpp32
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.h2
-rw-r--r--sources/shiboken2/libshiboken/bindingmanager.cpp12
-rw-r--r--sources/shiboken2/libshiboken/bufferprocs27.cpp2
-rw-r--r--sources/shiboken2/libshiboken/pep384impl.cpp22
-rw-r--r--sources/shiboken2/libshiboken/pep384impl.h19
-rw-r--r--sources/shiboken2/libshiboken/sbkconverter.cpp6
-rw-r--r--sources/shiboken2/libshiboken/sbkenum.cpp22
-rw-r--r--sources/shiboken2/libshiboken/signature.cpp8
-rw-r--r--sources/shiboken2/libshiboken/voidptr.cpp8
-rw-r--r--sources/shiboken2/tests/samplebinding/typesystem_sample.xml4
29 files changed, 134 insertions, 141 deletions
diff --git a/sources/pyside2/PySide2/QtCore/glue/qbytearray_mgetitem.cpp b/sources/pyside2/PySide2/QtCore/glue/qbytearray_mgetitem.cpp
index f1d5a6bfc..9612f41b0 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",
- PepType((Py_TYPE(_key)))->tp_name);
+ Py_TYPE(_key)->tp_name);
return NULL;
}
diff --git a/sources/pyside2/PySide2/QtCore/glue/qbytearray_msetitem.cpp b/sources/pyside2/PySide2/QtCore/glue/qbytearray_msetitem.cpp
index 6745fc964..1349f40f1 100644
--- a/sources/pyside2/PySide2/QtCore/glue/qbytearray_msetitem.cpp
+++ b/sources/pyside2/PySide2/QtCore/glue/qbytearray_msetitem.cpp
@@ -67,7 +67,7 @@ if (PyIndex_Check(_key)) {
PyErr_SetString(PyExc_ValueError, "bytearray must be of size 1");
return -1;
}
- } else if (PepType(Py_TYPE(_value)) == PepType(SbkPySide2_QtCoreTypes[SBK_QBYTEARRAY_IDX])) {
+ } else if (reinterpret_cast<PyTypeObject *>(Py_TYPE(_value)) == reinterpret_cast<PyTypeObject *>(SbkPySide2_QtCoreTypes[SBK_QBYTEARRAY_IDX])) {
if (PyObject_Length(_value) != 1) {
PyErr_SetString(PyExc_ValueError, "QByteArray must be of size 1");
return -1;
@@ -109,15 +109,15 @@ if (PyIndex_Check(_key)) {
if (_value == NULL || _value == Py_None) {
ba = QByteArray();
value_length = 0;
- } else if (!(PyBytes_Check(_value) || PyByteArray_Check(_value) || PepType(Py_TYPE(_value)) == PepType(SbkPySide2_QtCoreTypes[SBK_QBYTEARRAY_IDX]))) {
- PyErr_Format(PyExc_TypeError, "bytes, bytearray or QByteArray is required, not %.200s", PepType(Py_TYPE(_value))->tp_name);
+ } else if (!(PyBytes_Check(_value) || PyByteArray_Check(_value) || reinterpret_cast<PyTypeObject *>(Py_TYPE(_value)) == reinterpret_cast<PyTypeObject *>(SbkPySide2_QtCoreTypes[SBK_QBYTEARRAY_IDX]))) {
+ PyErr_Format(PyExc_TypeError, "bytes, bytearray or QByteArray is required, not %.200s", Py_TYPE(_value)->tp_name);
return -1;
} else {
value_length = PyObject_Length(_value);
}
if (step != 1 && value_length != slicelength) {
- PyErr_Format(PyExc_ValueError, "attempt to assign %s of size %d to extended slice of size %d",PepType(Py_TYPE(_value))->tp_name, value_length, slicelength);
+ PyErr_Format(PyExc_ValueError, "attempt to assign %s of size %d to extended slice of size %d",Py_TYPE(_value)->tp_name, value_length, slicelength);
return -1;
}
@@ -151,7 +151,7 @@ if (PyIndex_Check(_key)) {
}
} else {
PyErr_Format(PyExc_TypeError, "QBytearray indices must be integers or slices, not %.200s",
- PepType(Py_TYPE(_key))->tp_name);
+ Py_TYPE(_key)->tp_name);
return -1;
}
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index cc63c0b7a..20cb508e8 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -461,16 +461,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 (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 (type->tp_bases) {
+ for (int i = 0; i &lt; PyTuple_GET_SIZE(type->tp_bases); ++i) {
+ const char *derivedName = QVariant_resolveMetaType(reinterpret_cast&lt;PyTypeObject *&gt;(PyTuple_GET_ITEM(
+ type->tp_bases, i)), typeId);
if (derivedName)
return derivedName;
}
}
- else if (PepType(type)->tp_base) {
- return QVariant_resolveMetaType(PepType(type)->tp_base, typeId);
+ else if (type->tp_base) {
+ return QVariant_resolveMetaType(type->tp_base, typeId);
}
}
*typeId = 0;
@@ -592,7 +592,7 @@
</add-conversion>
<add-conversion type="PyTypeObject">
const char *typeName;
- if (Shiboken::String::checkType(reinterpret_cast&lt;PyTypeObject*&gt;(%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.
@@ -601,7 +601,7 @@
else if (Py_TYPE(%in) == SbkObjectType_TypeF())
typeName = Shiboken::ObjectType::getOriginalName((SbkObjectType*)%in);
else
- typeName = PepType((reinterpret_cast&lt;PyTypeObject*&gt;(%in)))->tp_name;
+ typeName = reinterpret_cast&lt;PyTypeObject *&gt;(%in)->tp_name;
%out = QVariant::nameToType(typeName);
</add-conversion>
<add-conversion type="PyString" check="Shiboken::String::check(%in)">
@@ -2687,7 +2687,7 @@
if (aux == NULL) {
return NULL;
}
- QByteArray b(PepType(Py_TYPE(%PYSELF))->tp_name);
+ QByteArray b(Py_TYPE(%PYSELF)->tp_name);
#ifdef IS_PY3K
%PYARG_0 = PyUnicode_FromFormat("%s(%R)", b.constData(), aux);
#else
@@ -3241,8 +3241,8 @@
// %FUNCTION_NAME() - disable generation of c++ function call
(void) %2; // remove warning about unused variable
Shiboken::AutoDecRef emptyTuple(PyTuple_New(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);
+ PyObject *pyTimer = reinterpret_cast&lt;PyTypeObject *&gt;(Shiboken::SbkType&lt;QTimer&gt;())->tp_new(Shiboken::SbkType&lt;QTimer&gt;(), emptyTuple, 0);
+ reinterpret_cast&lt;PyTypeObject *&gt;(Shiboken::SbkType&lt;QTimer&gt;())->tp_init(pyTimer, emptyTuple, 0);
QTimer* timer = %CONVERTTOCPP[QTimer*](pyTimer);
Shiboken::AutoDecRef result(
@@ -3265,8 +3265,8 @@
<inject-code class="target" position="beginning">
// %FUNCTION_NAME() - disable generation of c++ function call
Shiboken::AutoDecRef emptyTuple(PyTuple_New(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);
+ PyObject *pyTimer = reinterpret_cast&lt;PyTypeObject *&gt;(Shiboken::SbkType&lt;QTimer&gt;())->tp_new(Shiboken::SbkType&lt;QTimer&gt;(), emptyTuple, 0);
+ reinterpret_cast&lt;PyTypeObject *&gt;(Shiboken::SbkType&lt;QTimer&gt;())->tp_init(pyTimer, emptyTuple, 0);
QTimer* timer = %CONVERTTOCPP[QTimer*](pyTimer);
timer->setSingleShot(true);
diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
index eee22b55c..7715cbe6c 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)",
- PepType((Py_TYPE(pyResult)))->tp_name);
+ 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 fa9eb6349..0b427c251 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(PepType(pyObjType)->tp_mro, reinterpret_cast<PyObject *>(qobjectType))) {
+ if (!PySequence_Contains(pyObjType->tp_mro, reinterpret_cast<PyObject *>(qobjectType))) {
PyErr_Format(PyExc_TypeError, "A type inherited from %s expected, got %s.",
- PepType(qobjectType)->tp_name, PepType(pyObjType)->tp_name);
+ qobjectType->tp_name, pyObjType->tp_name);
return -1;
}
@@ -229,7 +229,7 @@ void propListTpFree(void* self)
PySideProperty* pySelf = reinterpret_cast<PySideProperty*>(self);
delete reinterpret_cast<QmlListProperty*>(PySide::Property::userData(pySelf));
// calls base type constructor
- PepType(PepType(Py_TYPE(pySelf))->tp_base)->tp_free(self);
+ Py_TYPE(pySelf)->tp_base->tp_free(self);
}
static PyType_Slot PropertyListType_slots[] = {
@@ -364,7 +364,7 @@ QtQml_VolatileBoolObject_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return Q_NULLPTR;
QtQml_VolatileBoolObject *self
- = reinterpret_cast<QtQml_VolatileBoolObject *>(PepType(type)->tp_alloc(type, 0));
+ = reinterpret_cast<QtQml_VolatileBoolObject *>(type->tp_alloc(type, 0));
if (self != Q_NULLPTR)
self->flag = ok;
@@ -421,10 +421,10 @@ QtQml_VolatileBoolObject_repr(QtQml_VolatileBoolObject *self)
if (self->flag)
s = PyBytes_FromFormat("%s(True)",
- PepType((Py_TYPE(self)))->tp_name);
+ Py_TYPE(self)->tp_name);
else
s = PyBytes_FromFormat("%s(False)",
- PepType((Py_TYPE(self)))->tp_name);
+ Py_TYPE(self)->tp_name);
Py_XINCREF(s);
return s;
}
@@ -436,10 +436,10 @@ QtQml_VolatileBoolObject_str(QtQml_VolatileBoolObject *self)
if (self->flag)
s = PyBytes_FromFormat("%s(True) -> %p",
- PepType((Py_TYPE(self)))->tp_name, &(self->flag));
+ Py_TYPE(self)->tp_name, &(self->flag));
else
s = PyBytes_FromFormat("%s(False) -> %p",
- PepType((Py_TYPE(self)))->tp_name, &(self->flag));
+ Py_TYPE(self)->tp_name, &(self->flag));
Py_XINCREF(s);
return s;
}
diff --git a/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp b/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
index 67ef53551..bf3ff06a2 100644
--- a/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
+++ b/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
@@ -110,7 +110,7 @@ bool pyTypeObjectInheritsFromClass(PyTypeObject *pyObjType, QByteArray className
{
className.append('*');
PyTypeObject *classPyType = Shiboken::Conversions::getPythonTypeObject(className.constData());
- bool isDerived = PySequence_Contains(PepType(pyObjType)->tp_mro,
+ bool isDerived = PySequence_Contains(pyObjType->tp_mro,
reinterpret_cast<PyObject *>(classPyType));
return isDerived;
}
@@ -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(PepType(pyObjType)->tp_mro,
+ bool isQuickItem = PySequence_Contains(pyObjType->tp_mro,
reinterpret_cast<PyObject *>(qQuickItemPyType));
// Register only classes that inherit QQuickItem or its children.
diff --git a/sources/pyside2/PySide2/QtScript/typesystem_script.xml b/sources/pyside2/PySide2/QtScript/typesystem_script.xml
index dc089a300..d2d3e3182 100644
--- a/sources/pyside2/PySide2/QtScript/typesystem_script.xml
+++ b/sources/pyside2/PySide2/QtScript/typesystem_script.xml
@@ -85,11 +85,11 @@
<inject-code class="target" position="beginning">
if (%CPPSELF.isVariant() || %CPPSELF.isString()) {
QString format = QString().sprintf("%s(\"%s\")",
- PepType(Py_TYPE(%PYSELF))->tp_name,
+ Py_TYPE(%PYSELF)->tp_name,
qPrintable(%CPPSELF.toString()));
%PYARG_0 = Shiboken::String::fromCString(qPrintable(format));
} else {
- %PYARG_0 = Shiboken::String::fromCString(PepType(Py_TYPE(%PYSELF))->tp_name);
+ %PYARG_0 = Shiboken::String::fromCString(Py_TYPE(%PYSELF)->tp_name);
}
</inject-code>
</add-function>
diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
index 11e6a9f7a..125d63054 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(PepType(Sbk_QGraphicsItem_TypeF())->tp_dict, "UserType", userTypeConstant);
+ PyDict_SetItemString(reinterpret_cast&lt;PyTypeObject *&gt;(Sbk_QGraphicsItem_TypeF())->tp_dict, "UserType", userTypeConstant);
</inject-code>
<modify-function signature="setParentItem(QGraphicsItem*)">
<modify-argument index="this">
diff --git a/sources/pyside2/PySide2/typesystem_templates.xml b/sources/pyside2/PySide2/typesystem_templates.xml
index 103d773cf..b13ab4b63 100644
--- a/sources/pyside2/PySide2/typesystem_templates.xml
+++ b/sources/pyside2/PySide2/typesystem_templates.xml
@@ -315,11 +315,11 @@
<!-- templates for __repr__ -->
<template name="repr_code">
QString format = QString().sprintf("%s(%REPR_FORMAT)",
- PepType(Py_TYPE(%PYSELF))->tp_name, %REPR_ARGS);
+ 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(PepType(Py_TYPE(%PYSELF))->tp_name);
+ QString format= QString("%1((").arg(Py_TYPE(%PYSELF)->tp_name);
QList&lt; %MATRIX_TYPE &gt; cppArgs;
%MATRIX_TYPE data[%MATRIX_SIZE];
diff --git a/sources/pyside2/libpyside/dynamicqmetaobject.cpp b/sources/pyside2/libpyside/dynamicqmetaobject.cpp
index 5b426ae8e..af2f416c6 100644
--- a/sources/pyside2/libpyside/dynamicqmetaobject.cpp
+++ b/sources/pyside2/libpyside/dynamicqmetaobject.cpp
@@ -388,7 +388,7 @@ DynamicQMetaObject::DynamicQMetaObject(PyTypeObject* type, const QMetaObject* ba
d.relatedMetaObjects = NULL;
d.static_metacall = NULL;
- m_d->m_className = QByteArray(PepType(type)->tp_name).split('.').last();
+ m_d->m_className = QByteArray(type->tp_name).split('.').last();
m_d->m_methodOffset = base->methodCount() - 1;
m_d->m_propertyOffset = base->propertyCount() - 1;
parsePythonType(type);
@@ -591,7 +591,7 @@ void DynamicQMetaObject::parsePythonType(PyTypeObject *type)
// This enforces registering of all signals and slots at type parsing time, and not later at
// signal connection time, thus making sure no method indices change which would break
// existing connections.
- const PyObject *mro = PepType(type)->tp_mro;
+ const PyObject *mro = type->tp_mro;
const Py_ssize_t basesCount = PyTuple_GET_SIZE(mro);
PyTypeObject *qObjectType = Shiboken::Conversions::getPythonTypeObject("QObject*");
QVector<PyTypeObject *> basesToCheck;
@@ -611,7 +611,7 @@ void DynamicQMetaObject::parsePythonType(PyTypeObject *type)
// PYSIDE-315: Handle all signals first, in all involved types.
for (int baseIndex = 0, baseEnd = basesToCheck.size(); baseIndex < baseEnd; ++baseIndex) {
PyTypeObject *baseType = basesToCheck[baseIndex];
- PyObject *attrs = PepType(baseType)->tp_dict;
+ PyObject *attrs = baseType->tp_dict;
PyObject *key = 0;
PyObject *value = 0;
Py_ssize_t pos = 0;
@@ -643,7 +643,7 @@ void DynamicQMetaObject::parsePythonType(PyTypeObject *type)
// We check for this using "is_sorted()". Sorting no longer happens at all.
for (int baseIndex = 0, baseEnd = basesToCheck.size(); baseIndex < baseEnd; ++baseIndex) {
PyTypeObject *baseType = basesToCheck[baseIndex];
- PyObject *attrs = PepType(baseType)->tp_dict;
+ PyObject *attrs = baseType->tp_dict;
PyObject *key = 0;
PyObject *value = 0;
Py_ssize_t pos = 0;
diff --git a/sources/pyside2/libpyside/pyside.cpp b/sources/pyside2/libpyside/pyside.cpp
index cb6f0721f..d6f4e5a37 100644
--- a/sources/pyside2/libpyside/pyside.cpp
+++ b/sources/pyside2/libpyside/pyside.cpp
@@ -309,10 +309,10 @@ PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* nam
bool inherits(PyTypeObject* objType, const char* class_name)
{
- if (strcmp(PepType(objType)->tp_name, class_name) == 0)
+ if (strcmp(objType->tp_name, class_name) == 0)
return true;
- PyTypeObject* base = PepType(objType)->tp_base;
+ PyTypeObject* base = objType->tp_base;
if (base == 0)
return false;
diff --git a/sources/pyside2/libpyside/pysideclassinfo.cpp b/sources/pyside2/libpyside/pysideclassinfo.cpp
index 5e0ffed39..24a0c642b 100644
--- a/sources/pyside2/libpyside/pysideclassinfo.cpp
+++ b/sources/pyside2/libpyside/pysideclassinfo.cpp
@@ -127,7 +127,7 @@ PyObject *classCall(PyObject *self, PyObject *args, PyObject * /* kw */)
static PyObject *classInfoTpNew(PyTypeObject *subtype, PyObject * /* args */, PyObject * /* kwds */)
{
- PySideClassInfo* me = reinterpret_cast<PySideClassInfo*>(PepType(subtype)->tp_alloc(subtype, 0));
+ PySideClassInfo* me = reinterpret_cast<PySideClassInfo*>(subtype->tp_alloc(subtype, 0));
me->d = new PySideClassInfoPrivate;
me->d->m_alreadyWrapped = false;
@@ -170,7 +170,7 @@ void classInfoFree(void *self)
PySideClassInfo* data = reinterpret_cast<PySideClassInfo*>(self);
delete data->d;
- PepType(PepType(Py_TYPE(pySelf))->tp_base)->tp_free(self);
+ Py_TYPE(pySelf)->tp_base->tp_free(self);
}
diff --git a/sources/pyside2/libpyside/pysideproperty.cpp b/sources/pyside2/libpyside/pysideproperty.cpp
index ccec8a2cb..279e09ec1 100644
--- a/sources/pyside2/libpyside/pysideproperty.cpp
+++ b/sources/pyside2/libpyside/pysideproperty.cpp
@@ -152,7 +152,7 @@ static void qpropertyMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::C
static PyObject *qpropertyTpNew(PyTypeObject *subtype, PyObject * /* args */, PyObject * /* kwds */)
{
- PySideProperty* me = reinterpret_cast<PySideProperty*>(PepType(subtype)->tp_alloc(subtype, 0));
+ PySideProperty* me = reinterpret_cast<PySideProperty*>(subtype->tp_alloc(subtype, 0));
me->d = new PySidePropertyPrivate;
memset(me->d, 0, sizeof(PySidePropertyPrivate));
PySidePropertyPrivate* pData = me->d;
@@ -210,7 +210,7 @@ int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
void qpropertyDeAlloc(PyObject* self)
{
qpropertyClear(self);
- PepType(Py_TYPE(self))->tp_free(self);
+ Py_TYPE(self)->tp_free(self);
}
PyObject *qPropertyCall(PyObject *self, PyObject *args, PyObject * /* kw */)
@@ -307,9 +307,9 @@ namespace {
static PyObject* getFromType(PyTypeObject* type, PyObject* name)
{
PyObject* attr = 0;
- attr = PyDict_GetItem(PepType(type)->tp_dict, name);
+ attr = PyDict_GetItem(type->tp_dict, name);
if (!attr) {
- PyObject* bases = PepType(type)->tp_bases;
+ PyObject* bases = type->tp_bases;
int size = PyTuple_GET_SIZE(bases);
for(int i=0; i < size; i++) {
PyObject* base = PyTuple_GET_ITEM(bases, i);
diff --git a/sources/pyside2/libpyside/pysideqflags.cpp b/sources/pyside2/libpyside/pysideqflags.cpp
index f4263403b..7a8fa2a05 100644
--- a/sources/pyside2/libpyside/pysideqflags.cpp
+++ b/sources/pyside2/libpyside/pysideqflags.cpp
@@ -54,7 +54,7 @@ extern "C" {
*/
struct PySideQFlagsType
{
- PepTypeObject type;
+ PyTypeObject type;
};
#define PYSIDE_QFLAGS(X) reinterpret_cast<PySideQFlagsObject*>(X)
diff --git a/sources/pyside2/libpyside/pysidesignal.cpp b/sources/pyside2/libpyside/pysidesignal.cpp
index 483e9e050..f3ba84d3b 100644
--- a/sources/pyside2/libpyside/pysidesignal.cpp
+++ b/sources/pyside2/libpyside/pysidesignal.cpp
@@ -253,7 +253,7 @@ void signalFree(void* self)
Py_XDECREF(data->homonymousMethod);
data->homonymousMethod = 0;
- PepType(PepType(Py_TYPE(pySelf))->tp_base)->tp_free(self);
+ Py_TYPE(pySelf)->tp_base->tp_free(self);
}
PyObject* signalGetItem(PyObject* self, PyObject* key)
@@ -298,7 +298,7 @@ void signalInstanceFree(void* self)
}
delete dataPvt;
data->d = 0;
- PepType(PepType(Py_TYPE(pySelf))->tp_base)->tp_free(self);
+ Py_TYPE(pySelf)->tp_base->tp_free(self);
}
PyObject* signalInstanceConnect(PyObject* self, PyObject* args, PyObject* kwds)
@@ -552,7 +552,7 @@ PyObject* signalCall(PyObject* self, PyObject* args, PyObject* kw)
return 0;
}
- descrgetfunc getDescriptor = PepType(Py_TYPE(signal->homonymousMethod))->tp_descr_get;
+ descrgetfunc getDescriptor = Py_TYPE(signal->homonymousMethod)->tp_descr_get;
// Check if there exists a method with the same name as the signal, which is also a static
// method in C++ land.
@@ -563,7 +563,7 @@ PyObject* signalCall(PyObject* self, PyObject* args, PyObject* kw)
}
// Assumes homonymousMethod is not a static method.
- ternaryfunc callFunc = PepType(Py_TYPE(signal->homonymousMethod))->tp_call;
+ ternaryfunc callFunc = Py_TYPE(signal->homonymousMethod)->tp_call;
return callFunc(homonymousMethod, args, kw);
}
@@ -575,7 +575,7 @@ PyObject* signalInstanceCall(PyObject* self, PyObject* args, PyObject* kw)
return 0;
}
- descrgetfunc getDescriptor = PepType(Py_TYPE(PySideSignal->d->homonymousMethod))->tp_descr_get;
+ descrgetfunc getDescriptor = Py_TYPE(PySideSignal->d->homonymousMethod)->tp_descr_get;
Shiboken::AutoDecRef homonymousMethod(getDescriptor(PySideSignal->d->homonymousMethod, PySideSignal->d->source, 0));
return PyCFunction_Call(homonymousMethod, args, kw);
}
@@ -625,7 +625,7 @@ void updateSourceObject(PyObject* source)
PyObject* value;
PyObject* key;
- while (PyDict_Next(PepType(objType)->tp_dict, &pos, &key, &value)) {
+ while (PyDict_Next(objType->tp_dict, &pos, &key, &value)) {
if (PyObject_TypeCheck(value, PySideSignalTypeF())) {
Shiboken::AutoDecRef signalInstance(reinterpret_cast<PyObject *>(PyObject_New(PySideSignalInstance, PySideSignalInstanceTypeF())));
instanceInitialize(signalInstance.cast<PySideSignalInstance*>(), key, reinterpret_cast<PySideSignal*>(value), source, 0);
@@ -855,7 +855,7 @@ static typename T::value_type join(T t, const char* sep)
static void _addSignalToWrapper(SbkObjectType* wrapperType, const char* signalName, PySideSignal* signal)
{
- PyObject* typeDict = PepType(wrapperType)->tp_dict;
+ PyObject* typeDict = reinterpret_cast<PyTypeObject *>(wrapperType)->tp_dict;
PyObject* homonymousMethod;
if ((homonymousMethod = PyDict_GetItemString(typeDict, signalName))) {
Py_INCREF(homonymousMethod);
diff --git a/sources/pyside2/libpyside/pysideslot.cpp b/sources/pyside2/libpyside/pysideslot.cpp
index db1a7d9ed..fddff54fa 100644
--- a/sources/pyside2/libpyside/pysideslot.cpp
+++ b/sources/pyside2/libpyside/pysideslot.cpp
@@ -113,7 +113,7 @@ int slotTpInit(PyObject *self, PyObject *args, PyObject *kw)
data->args = typeName;
}
} else {
- PyErr_Format(PyExc_TypeError, "Unknown signal argument type: %s", PepType((Py_TYPE(argType)))->tp_name);
+ PyErr_Format(PyExc_TypeError, "Unknown signal argument type: %s", Py_TYPE(argType)->tp_name);
return -1;
}
}
diff --git a/sources/pyside2/plugins/customwidget.cpp b/sources/pyside2/plugins/customwidget.cpp
index bad05f2d3..f3ce09b62 100644
--- a/sources/pyside2/plugins/customwidget.cpp
+++ b/sources/pyside2/plugins/customwidget.cpp
@@ -51,7 +51,7 @@ PyCustomWidget::PyCustomWidget(PyObject* objectType)
: m_data(new PyCustomWidgetPrivate())
{
m_data->pyObject = objectType;
- m_name = QString(PepType(reinterpret_cast<PyTypeObject*>(objectType))->tp_name);
+ m_name = QString(reinterpret_cast<PyTypeObject *>(objectType)->tp_name);
}
PyCustomWidget::~PyCustomWidget()
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index a9556fa4c..5e3f890f8 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -667,7 +667,7 @@ QString CppGenerator::getVirtualFunctionReturnTypeName(const AbstractMetaFunctio
if (func->type()->isPrimitive())
return QLatin1Char('"') + func->type()->name() + QLatin1Char('"');
- return QString::fromLatin1("PepType(Shiboken::SbkType< %1 >())->tp_name").arg(func->type()->typeEntry()->qualifiedCppName());
+ return QString::fromLatin1("reinterpret_cast<PyTypeObject *>(Shiboken::SbkType< %1 >())->tp_name").arg(func->type()->typeEntry()->qualifiedCppName());
}
void CppGenerator::writeVirtualMethodNative(QTextStream&s, const AbstractMetaFunction* func)
@@ -894,7 +894,7 @@ void CppGenerator::writeVirtualMethodNative(QTextStream&s, const AbstractMetaFun
s << INDENT << "Shiboken::warning(PyExc_RuntimeWarning, 2, "\
"\"Invalid return value in function %s, expected %s, got %s.\", \"";
s << func->ownerClass()->name() << '.' << funcName << "\", " << getVirtualFunctionReturnTypeName(func);
- s << ", PepType(Py_TYPE(" PYTHON_RETURN_VAR "))->tp_name);" << endl;
+ s << ", Py_TYPE(" PYTHON_RETURN_VAR ")->tp_name);" << endl;
s << INDENT << "return " << defaultReturnExpr << ';' << endl;
}
s << INDENT << '}' << endl;
@@ -914,7 +914,7 @@ void CppGenerator::writeVirtualMethodNative(QTextStream&s, const AbstractMetaFun
s << INDENT << "Shiboken::warning(PyExc_RuntimeWarning, 2, "\
"\"Invalid return value in function %s, expected %s, got %s.\", \"";
s << func->ownerClass()->name() << '.' << funcName << "\", " << getVirtualFunctionReturnTypeName(func);
- s << ", PepType(Py_TYPE(" PYTHON_RETURN_VAR "))->tp_name);" << endl;
+ s << ", Py_TYPE(" PYTHON_RETURN_VAR ")->tp_name);" << endl;
s << INDENT << "return " << defaultReturnExpr << ';' << endl;
}
s << INDENT << '}' << endl;
@@ -4056,7 +4056,7 @@ void CppGenerator::writeTpTraverseFunction(QTextStream& s, const AbstractMetaCla
s << "static int ";
s << baseName << "_traverse(PyObject* " PYTHON_SELF_VAR ", visitproc visit, void* arg)" << endl;
s << '{' << endl;
- s << INDENT << "return PepType(reinterpret_cast<PyTypeObject*>(SbkObject_TypeF()))->tp_traverse(" PYTHON_SELF_VAR ", visit, arg);" << endl;
+ s << INDENT << "return reinterpret_cast<PyTypeObject *>(SbkObject_TypeF())->tp_traverse(" PYTHON_SELF_VAR ", visit, arg);" << endl;
s << '}' << endl;
}
@@ -4066,7 +4066,7 @@ void CppGenerator::writeTpClearFunction(QTextStream& s, const AbstractMetaClass*
s << "static int ";
s << baseName << "_clear(PyObject* " PYTHON_SELF_VAR ")" << endl;
s << '{' << endl;
- s << INDENT << "return PepType(reinterpret_cast<PyTypeObject*>(SbkObject_TypeF()))->tp_clear(" PYTHON_SELF_VAR ");" << endl;
+ s << INDENT << "return reinterpret_cast<PyTypeObject *>(SbkObject_TypeF())->tp_clear(" PYTHON_SELF_VAR ");" << endl;
s << '}' << endl;
}
@@ -4539,7 +4539,7 @@ void CppGenerator::writeEnumInitialization(QTextStream& s, const AbstractMetaEnu
{
Indentation indent(INDENT);
s << INDENT << "PyObject* anonEnumItem = PyInt_FromLong(" << enumValueText << ");" << endl;
- s << INDENT << "if (PyDict_SetItemString(PepType(reinterpret_cast<SbkObjectType *>(" << enclosingObjectVariable
+ s << INDENT << "if (PyDict_SetItemString(reinterpret_cast<PyTypeObject *>(reinterpret_cast<SbkObjectType *>(" << enclosingObjectVariable
<< "))->tp_dict, \"" << enumValue->name() << "\", anonEnumItem) < 0)" << endl;
{
Indentation indent(INDENT);
@@ -4907,7 +4907,7 @@ void CppGenerator::writeClassRegister(QTextStream &s,
for (const AbstractMetaField *field : fields) {
if (!field->isStatic())
continue;
- s << INDENT << QLatin1String("PyDict_SetItemString(PepType(") + cpythonTypeName(metaClass) + QLatin1String(")->tp_dict, \"");
+ s << INDENT << QLatin1String("PyDict_SetItemString(reinterpret_cast<PyTypeObject *>(") + cpythonTypeName(metaClass) + QLatin1String(")->tp_dict, \"");
s << field->name() << "\", ";
writeToPythonConversion(s, field->type(), metaClass, metaClass->qualifiedCppName() + QLatin1String("::") + field->name());
s << ");" << endl;
@@ -5122,7 +5122,7 @@ void CppGenerator::writeGetattroFunction(QTextStream& s, GeneratorContext &conte
s << INDENT << "if (Shiboken::Object::isUserType(" PYTHON_SELF_VAR ")) {" << endl;
{
Indentation indent(INDENT);
- s << INDENT << "PyObject* meth = PyDict_GetItem(PepType(Py_TYPE(" PYTHON_SELF_VAR "))->tp_dict, name);" << endl;
+ s << INDENT << "PyObject* meth = PyDict_GetItem(reinterpret_cast<PyTypeObject *>(Py_TYPE(" PYTHON_SELF_VAR "))->tp_dict, name);" << endl;
s << INDENT << "if (meth)" << endl;
{
Indentation indent(INDENT);
@@ -5187,7 +5187,7 @@ void CppGenerator::writeGetattroFunction(QTextStream& s, GeneratorContext &conte
s << INDENT << "PyTypeObject *tp = Py_TYPE(self);" << endl;
s << INDENT << "PyErr_Format(PyExc_AttributeError," << endl;
s << INDENT << " \"'%.50s' object has no attribute '%.400s'\"," << endl;
- s << INDENT << " PepType(tp)->tp_name, PyBytes_AS_STRING(name));" << endl;
+ s << INDENT << " tp->tp_name, PyBytes_AS_STRING(name));" << endl;
s << INDENT << "return NULL;" << endl;
}
s << INDENT << "} else {" << endl;
@@ -5267,7 +5267,7 @@ bool CppGenerator::finishGeneration()
QString defineStr = QLatin1String("init_") + cls->qualifiedCppName().replace(QLatin1String("::"), QLatin1String("_"));
if (cls->enclosingClass() && (cls->enclosingClass()->typeEntry()->codeGeneration() != TypeEntry::GenerateForSubclass))
- defineStr += QLatin1String("(PepType(") + cpythonTypeNameExt(cls->enclosingClass()->typeEntry()) + QLatin1String(")->tp_dict);");
+ defineStr += QLatin1String("(reinterpret_cast<PyTypeObject *>(") + cpythonTypeNameExt(cls->enclosingClass()->typeEntry()) + QLatin1String(")->tp_dict);");
else
defineStr += QLatin1String("(module);");
s_classPythonDefines << INDENT << defineStr << endl;
@@ -5813,9 +5813,9 @@ QString CppGenerator::writeReprFunction(QTextStream &s, GeneratorContext &contex
s << INDENT << "if (idx >= 0)" << endl;
{
Indentation indent(INDENT);
- s << INDENT << "str.replace(0, idx, PepType((Py_TYPE(self)))->tp_name);" << endl;
+ s << INDENT << "str.replace(0, idx, Py_TYPE(self)->tp_name);" << endl;
}
- s << INDENT << "PyObject* mod = PyDict_GetItemString(PepType(Py_TYPE(self))->tp_dict, \"__module__\");" << endl;
+ s << INDENT << "PyObject* mod = PyDict_GetItemString(Py_TYPE(self)->tp_dict, \"__module__\");" << endl;
// PYSIDE-595: The introduction of heap types has the side effect that the module name
// is always prepended to the type name. Therefore the strchr check:
s << INDENT << "if (mod && !strchr(str, '.'))" << endl;
diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp
index 43c162dec..ec705a421 100644
--- a/sources/shiboken2/libshiboken/basewrapper.cpp
+++ b/sources/shiboken2/libshiboken/basewrapper.cpp
@@ -180,8 +180,8 @@ SbkObjectType *SbkObject_TypeF(void)
type = reinterpret_cast<PyTypeObject *>(PyType_FromSpec(&SbkObject_Type_spec));
Py_TYPE(type) = SbkObjectType_TypeF();
Py_INCREF(Py_TYPE(type));
- PepType(type)->tp_weaklistoffset = offsetof(SbkObject, weakreflist);
- PepType(type)->tp_dictoffset = offsetof(SbkObject, ob_dict);
+ type->tp_weaklistoffset = offsetof(SbkObject, weakreflist);
+ type->tp_dictoffset = offsetof(SbkObject, ob_dict);
}
return reinterpret_cast<SbkObjectType *>(type);
}
@@ -306,18 +306,18 @@ PyObject* SbkObjectTypeTpNew(PyTypeObject* metatype, PyObject* args, PyObject* k
#ifndef IS_PY3K
if (PyClass_Check(baseType)) {
PyErr_Format(PyExc_TypeError, "Invalid base class used in type %s. "
- "PySide only support multiple inheritance from python new style class.", PepType(metatype)->tp_name);
+ "PySide only support multiple inheritance from python new style class.", metatype->tp_name);
return 0;
}
#endif
- if (PepType(reinterpret_cast<PyTypeObject*>(baseType))->tp_new == SbkDummyNew) {
+ if (reinterpret_cast<PyTypeObject *>(baseType)->tp_new == SbkDummyNew) {
// PYSIDE-595: A base class does not allow inheritance.
return SbkDummyNew(metatype, args, kwds);
}
}
// The meta type creates a new type when the Python programmer extends a wrapped C++ class.
- newfunc type_new = reinterpret_cast<newfunc>(PepType(&PyType_Type)->tp_new);
+ newfunc type_new = reinterpret_cast<newfunc>(PyType_Type.tp_new);
SbkObjectType *newType = reinterpret_cast<SbkObjectType*>(type_new(metatype, args, kwds));
if (!newType)
return 0;
@@ -425,7 +425,7 @@ SbkDummyNew(PyTypeObject *type, PyObject*, PyObject*)
// PYSIDE-595: Give the same error as type_call does when tp_new is NULL.
PyErr_Format(PyExc_TypeError,
"cannot create '%.100s' instances ¯\\_(ツ)_/¯",
- PepType(type)->tp_name);
+ type->tp_name);
return nullptr;
}
@@ -458,7 +458,7 @@ static void decRefPyObjectList(const std::list<PyObject*> &pyObj, PyObject* skip
static void _walkThroughClassHierarchy(PyTypeObject* currentType, HierarchyVisitor* visitor)
{
- PyObject* bases = PepType(currentType)->tp_bases;
+ PyObject* bases = currentType->tp_bases;
Py_ssize_t numBases = PyTuple_GET_SIZE(bases);
for (int i = 0; i < numBases; ++i) {
PyTypeObject* type = reinterpret_cast<PyTypeObject*>(PyTuple_GET_ITEM(bases, i));
@@ -577,10 +577,10 @@ void setErrorAboutWrongArguments(PyObject* args, const char* funcName, const cha
if (i)
params += ", ";
PyObject* arg = PyTuple_GET_ITEM(args, i);
- params += PepType((Py_TYPE(arg)))->tp_name;
+ params += Py_TYPE(arg)->tp_name;
}
} else {
- params = PepType((Py_TYPE(args)))->tp_name;
+ params = Py_TYPE(args)->tp_name;
}
}
@@ -669,7 +669,7 @@ bool canCallConstructor(PyTypeObject* myType, PyTypeObject* ctorType)
FindBaseTypeVisitor visitor(ctorType);
walkThroughClassHierarchy(myType, &visitor);
if (!visitor.found()) {
- PyErr_Format(PyExc_TypeError, "%s isn't a direct base class of %s", PepType(ctorType)->tp_name, PepType(myType)->tp_name);
+ PyErr_Format(PyExc_TypeError, "%s isn't a direct base class of %s", ctorType->tp_name, myType->tp_name);
return false;
}
return true;
@@ -1105,13 +1105,13 @@ bool isValid(PyObject* pyObj)
if (!priv->cppObjectCreated && isUserType(pyObj)) {
PyErr_Format(PyExc_RuntimeError, "'__init__' method of object's base class (%s) not called.",
- PepType((Py_TYPE(pyObj)))->tp_name);
+ Py_TYPE(pyObj)->tp_name);
return false;
}
if (!priv->validCppObject) {
PyErr_Format(PyExc_RuntimeError, "Internal C++ object (%s) already deleted.",
- PepType((Py_TYPE(pyObj)))->tp_name);
+ Py_TYPE(pyObj)->tp_name);
return false;
}
@@ -1127,14 +1127,14 @@ bool isValid(SbkObject* pyObj, bool throwPyError)
if (!priv->cppObjectCreated && isUserType(reinterpret_cast<PyObject*>(pyObj))) {
if (throwPyError)
PyErr_Format(PyExc_RuntimeError, "Base constructor of the object (%s) not called.",
- PepType((Py_TYPE(pyObj)))->tp_name);
+ Py_TYPE(pyObj)->tp_name);
return false;
}
if (!priv->validCppObject) {
if (throwPyError)
PyErr_Format(PyExc_RuntimeError, "Internal C++ object (%s) already deleted.",
- PepType((Py_TYPE(pyObj)))->tp_name);
+ (Py_TYPE(pyObj))->tp_name);
return false;
}
@@ -1415,7 +1415,7 @@ void deallocData(SbkObject* self, bool cleanup)
// PYSIDE-571: qApp is no longer allocated.
if (PyObject_IS_GC(reinterpret_cast<PyObject*>(self)))
- PepType(Py_TYPE(self))->tp_free(self);
+ Py_TYPE(self)->tp_free(self);
}
void setTypeUserData(SbkObject* wrapper, void* userData, DeleteUserDataFunc d_func)
@@ -1512,7 +1512,7 @@ std::string info(SbkObject* self)
s << "C++ address....... ";
std::list<SbkObjectType*>::const_iterator it = bases.begin();
for (int i = 0; it != bases.end(); ++it, ++i)
- s << PepType((reinterpret_cast<PyTypeObject*>(*it)))->tp_name << '/' << self->d->cptr[i] << ' ';
+ s << reinterpret_cast<PyTypeObject *>(*it)->tp_name << '/' << self->d->cptr[i] << ' ';
s << "\n";
}
else {
diff --git a/sources/shiboken2/libshiboken/basewrapper.h b/sources/shiboken2/libshiboken/basewrapper.h
index 755058e8b..06b17a151 100644
--- a/sources/shiboken2/libshiboken/basewrapper.h
+++ b/sources/shiboken2/libshiboken/basewrapper.h
@@ -101,7 +101,7 @@ struct SbkObjectTypePrivate;
/// PyTypeObject extended with C++ multiple inheritance information.
struct LIBSHIBOKEN_API SbkObjectType
{
- PepTypeObject type;
+ PyTypeObject type;
};
LIBSHIBOKEN_API PyObject* SbkObjectTpNew(PyTypeObject* subtype, PyObject*, PyObject*);
diff --git a/sources/shiboken2/libshiboken/bindingmanager.cpp b/sources/shiboken2/libshiboken/bindingmanager.cpp
index 5a3283ab5..2cc7847a8 100644
--- a/sources/shiboken2/libshiboken/bindingmanager.cpp
+++ b/sources/shiboken2/libshiboken/bindingmanager.cpp
@@ -84,8 +84,8 @@ public:
const NodeList& nodeList = i->second;
NodeList::const_iterator j = nodeList.begin();
for (; j != nodeList.end(); ++j) {
- file << '"' << PepType(*j)->tp_name << "\" -> \""
- << PepType(node1)->tp_name << "\"\n";
+ file << '"' << reinterpret_cast<PyTypeObject *>(*j)->tp_name << "\" -> \""
+ << reinterpret_cast<PyTypeObject *>(node1)->tp_name << "\"\n";
}
}
file << "}\n";
@@ -133,7 +133,7 @@ static void showWrapperMap(const WrapperMap& wrapperMap)
const SbkObject *sbkObj = iter->second;
fprintf(stderr, "key: %p, value: %p (%s, refcnt: %d)\n", iter->first,
static_cast<const void *>(sbkObj),
- PepType((Py_TYPE(sbkObj)))->tp_name,
+ (Py_TYPE(sbkObj))->tp_name,
int(reinterpret_cast<const PyObject *>(sbkObj)->ob_refcnt));
}
fprintf(stderr, "-------------------------------\n");
@@ -285,14 +285,14 @@ PyObject* BindingManager::getOverride(const void* cptr, const char* methodName)
if (method && PyMethod_Check(method)
&& PyMethod_GET_SELF(method) == reinterpret_cast<PyObject*>(wrapper)) {
PyObject* defaultMethod;
- PyObject* mro = PepType(Py_TYPE(wrapper))->tp_mro;
+ PyObject* mro = Py_TYPE(wrapper)->tp_mro;
// The first class in the mro (index 0) is the class being checked and it should not be tested.
// The last class in the mro (size - 1) is the base Python object class which should not be tested also.
for (int i = 1; i < PyTuple_GET_SIZE(mro) - 1; i++) {
PyTypeObject* parent = reinterpret_cast<PyTypeObject*>(PyTuple_GET_ITEM(mro, i));
- if (PepType(parent)->tp_dict) {
- defaultMethod = PyDict_GetItem(PepType(parent)->tp_dict, pyMethodName);
+ if (parent->tp_dict) {
+ defaultMethod = PyDict_GetItem(parent->tp_dict, pyMethodName);
if (defaultMethod && PyMethod_GET_FUNCTION(method) != defaultMethod) {
Py_DECREF(pyMethodName);
return method;
diff --git a/sources/shiboken2/libshiboken/bufferprocs27.cpp b/sources/shiboken2/libshiboken/bufferprocs27.cpp
index 168a28a96..84d670d21 100644
--- a/sources/shiboken2/libshiboken/bufferprocs27.cpp
+++ b/sources/shiboken2/libshiboken/bufferprocs27.cpp
@@ -58,7 +58,7 @@ PyObject_GetBuffer(PyObject *obj, Pep_buffer *view, int flags)
if (pb == NULL || pb->bf_getbuffer == NULL) {
PyErr_Format(PyExc_TypeError,
"a bytes-like object is required, not '%.100s'",
- PepType((Py_TYPE(obj)))->tp_name);
+ Py_TYPE(obj)->tp_name);
return -1;
}
return (*pb->bf_getbuffer)(obj, view, flags);
diff --git a/sources/shiboken2/libshiboken/pep384impl.cpp b/sources/shiboken2/libshiboken/pep384impl.cpp
index f0e8f3457..b648330d8 100644
--- a/sources/shiboken2/libshiboken/pep384impl.cpp
+++ b/sources/shiboken2/libshiboken/pep384impl.cpp
@@ -190,9 +190,9 @@ extern "C"
struct LIBSHIBOKEN_API SbkObject
{
PyObject_HEAD
- PyObject* ob_dict;
- PyObject* weakreflist;
- SbkObjectPrivate* d;
+ PyObject *ob_dict;
+ PyObject *weakreflist;
+ SbkObjectPrivate *d;
};
The first step was to rename the SbkObjectTypePrivate from "d" to
@@ -217,7 +217,7 @@ extern "C"
#define _genericTypeExtender(etype) \
(reinterpret_cast<char*>(etype) + \
- (reinterpret_cast<PepTypeObject*>(&PyType_Type))->tp_basicsize)
+ (reinterpret_cast<PepTypeObject *>(&PyType_Type))->tp_basicsize)
#define PepType_SOTP(etype) \
(*reinterpret_cast<SbkObjectTypePrivate**>(_genericTypeExtender(etype)))
@@ -404,13 +404,13 @@ static PyType_Spec typeprobe_spec = {
static void
check_PepTypeObject_valid(void)
{
- PyObject *obtype = reinterpret_cast<PyObject*>(&PyType_Type);
- PyTypeObject *probe_tp_base = reinterpret_cast<PyTypeObject*>(
+ PyObject *obtype = reinterpret_cast<PyObject *>(&PyType_Type);
+ PyTypeObject *probe_tp_base = reinterpret_cast<PyTypeObject *>(
PyObject_GetAttrString(obtype, "__base__"));
PyObject *probe_tp_bases = PyObject_GetAttrString(obtype, "__bases__");
- PepTypeObject *check = reinterpret_cast<PepTypeObject*>(
+ PyTypeObject *check = reinterpret_cast<PyTypeObject *>(
PyType_FromSpecWithBases(&typeprobe_spec, probe_tp_bases));
- PepTypeObject *typetype = reinterpret_cast<PepTypeObject*>(obtype);
+ PyTypeObject *typetype = reinterpret_cast<PyTypeObject *>(obtype);
PyObject *w = PyObject_GetAttrString(obtype, "__weakrefoffset__");
long probe_tp_weakrefoffset = PyLong_AsLong(w);
PyObject *d = PyObject_GetAttrString(obtype, "__dictoffset__");
@@ -675,8 +675,8 @@ PyTime_FromTime(int hour, int min, int sec, int usec)
PyObject *
PyRun_String(const char *str, int start, PyObject *globals, PyObject *locals)
{
- PyObject* code = Py_CompileString(str, "pyscript", start);
- PyObject* ret = NULL;
+ PyObject *code = Py_CompileString(str, "pyscript", start);
+ PyObject *ret = NULL;
if (code != NULL) {
ret = PyEval_EvalCode(code, globals, locals);
@@ -811,7 +811,7 @@ static PyTypeObject *getStaticMethodType(void)
const char *
PepType_GetNameStr(PyTypeObject *type)
{
- const char *ret = PepType(type)->tp_name;
+ const char *ret = type->tp_name;
const char *nodots = strrchr(ret, '.');
if (nodots)
ret = nodots + 1;
diff --git a/sources/shiboken2/libshiboken/pep384impl.h b/sources/shiboken2/libshiboken/pep384impl.h
index 8f14c853a..643714f04 100644
--- a/sources/shiboken2/libshiboken/pep384impl.h
+++ b/sources/shiboken2/libshiboken/pep384impl.h
@@ -69,14 +69,9 @@ LIBSHIBOKEN_API void _PyObject_Dump(PyObject *);
/*
* There are a few structures that are needed, but cannot be used without
* breaking the API. We use some heuristics to get those fields anyway
- * and validate that we really found them, see Pepresolve.cpp .
+ * and validate that we really found them, see pep384impl.cpp .
*/
-// PepType is just a typecast that allows direct access. This is
-// often better to read than the reversal via the former macro
-// functions PepType_tp_xxx.
-#define PepType(o) (reinterpret_cast<PepTypeObject*>(o))
-
#ifdef Py_LIMITED_API
/*
@@ -87,7 +82,7 @@ LIBSHIBOKEN_API void _PyObject_Dump(PyObject *);
* When we need more fields, we replace it back and add it to the
* validation.
*/
-typedef struct _peptypeobject {
+typedef struct _typeobject {
PyVarObject ob_base;
const char *tp_name;
Py_ssize_t tp_basicsize;
@@ -131,7 +126,7 @@ typedef struct _peptypeobject {
PyObject *tp_bases;
PyObject *tp_mro; /* method resolution order */
-} PepTypeObject;
+} PyTypeObject;
// This was a macro error in the limited API from the beginning.
// It was fixed in Python master, but did make it only in Python 3.8 .
@@ -143,11 +138,9 @@ LIBSHIBOKEN_API int PyIndex_Check(PyObject *obj);
#undef PyObject_IS_GC
#define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) && \
- ( PepType(Py_TYPE(o))->tp_is_gc == NULL || \
- PepType(Py_TYPE(o))->tp_is_gc(o) ))
+ ( Py_TYPE(o)->tp_is_gc == NULL || \
+ Py_TYPE(o)->tp_is_gc(o) ))
-#else
-#define PepTypeObject PyTypeObject
#endif // Py_LIMITED_API
struct SbkObjectTypePrivate;
@@ -155,7 +148,7 @@ struct PySideQFlagsTypePrivate;
struct _SbkGenericTypePrivate;
#define PepHeapType_SIZE \
- (reinterpret_cast<PepTypeObject*>(&PyType_Type)->tp_basicsize)
+ (reinterpret_cast<PyTypeObject*>(&PyType_Type)->tp_basicsize)
#define _genericTypeExtender(etype) \
(reinterpret_cast<char*>(etype) + PepHeapType_SIZE)
diff --git a/sources/shiboken2/libshiboken/sbkconverter.cpp b/sources/shiboken2/libshiboken/sbkconverter.cpp
index f1be99a36..a13222de6 100644
--- a/sources/shiboken2/libshiboken/sbkconverter.cpp
+++ b/sources/shiboken2/libshiboken/sbkconverter.cpp
@@ -189,7 +189,7 @@ PyObject* pointerToPython(const SbkConverter *converter, const void *cppIn)
Py_RETURN_NONE;
if (!converter->pointerToPython) {
warning(PyExc_RuntimeWarning, 0, "pointerToPython(): SbkConverter::pointerToPython is null for \"%s\".",
- PepType(converter->pythonType)->tp_name);
+ converter->pythonType->tp_name);
Py_RETURN_NONE;
}
return converter->pointerToPython(cppIn);
@@ -211,7 +211,7 @@ PyObject* referenceToPython(const SbkConverter *converter, const void *cppIn)
}
if (!converter->pointerToPython) {
warning(PyExc_RuntimeWarning, 0, "referenceToPython(): SbkConverter::pointerToPython is null for \"%s\".",
- PepType(converter->pythonType)->tp_name);
+ converter->pythonType->tp_name);
Py_RETURN_NONE;
}
return converter->pointerToPython(cppIn);
@@ -223,7 +223,7 @@ static inline PyObject* CopyCppToPython(const SbkConverter *converter, const voi
Py_RETURN_NONE;
if (!converter->copyToPython) {
warning(PyExc_RuntimeWarning, 0, "CopyCppToPython(): SbkConverter::copyToPython is null for \"%s\".",
- PepType(converter->pythonType)->tp_name);
+ converter->pythonType->tp_name);
Py_RETURN_NONE;
}
return converter->copyToPython(cppIn);
diff --git a/sources/shiboken2/libshiboken/sbkenum.cpp b/sources/shiboken2/libshiboken/sbkenum.cpp
index 119591215..bd007f079 100644
--- a/sources/shiboken2/libshiboken/sbkenum.cpp
+++ b/sources/shiboken2/libshiboken/sbkenum.cpp
@@ -63,7 +63,7 @@ struct SbkEnumTypePrivate
struct SbkEnumType
{
- PepTypeObject type;
+ PyTypeObject type;
};
struct SbkEnumObject
@@ -77,9 +77,9 @@ static PyObject* SbkEnumObject_repr(PyObject* self)
{
const SbkEnumObject *enumObj = reinterpret_cast<SbkEnumObject *>(self);
if (enumObj->ob_name)
- return Shiboken::String::fromFormat("%s.%s", PepType((Py_TYPE(self)))->tp_name, PyBytes_AS_STRING(enumObj->ob_name));
+ return Shiboken::String::fromFormat("%s.%s", (Py_TYPE(self))->tp_name, PyBytes_AS_STRING(enumObj->ob_name));
else
- return Shiboken::String::fromFormat("%s(%ld)", PepType((Py_TYPE(self)))->tp_name, enumObj->ob_value);
+ return Shiboken::String::fromFormat("%s(%ld)", (Py_TYPE(self))->tp_name, enumObj->ob_value);
}
static PyObject* SbkEnumObject_name(PyObject* self, void*)
@@ -361,7 +361,7 @@ PyObject* getEnumItemFromValue(PyTypeObject* enumType, long itemValue)
{
PyObject *key, *value;
Py_ssize_t pos = 0;
- PyObject *values = PyDict_GetItemString(PepType(enumType)->tp_dict, const_cast<char*>("values"));
+ PyObject *values = PyDict_GetItemString(enumType->tp_dict, const_cast<char*>("values"));
while (PyDict_Next(values, &pos, &key, &value)) {
SbkEnumObject *obj = reinterpret_cast<SbkEnumObject *>(value);
@@ -395,10 +395,10 @@ PyTypeObject* createGlobalEnum(PyObject* module, const char* name, const char* f
PyTypeObject* createScopedEnum(SbkObjectType* scope, const char* name, const char* fullName, const char* cppName, PyTypeObject* flagsType)
{
PyTypeObject* enumType = createEnum(fullName, cppName, name, flagsType);
- if (enumType && PyDict_SetItemString(PepType(scope)->tp_dict, name,
+ if (enumType && PyDict_SetItemString(reinterpret_cast<PyTypeObject *>(scope)->tp_dict, name,
reinterpret_cast<PyObject *>(enumType)) < 0)
return nullptr;
- if (flagsType && PyDict_SetItemString(PepType(scope)->tp_dict,
+ if (flagsType && PyDict_SetItemString(reinterpret_cast<PyTypeObject *>(scope)->tp_dict,
PepType_GetNameStr(flagsType),
reinterpret_cast<PyObject *>(flagsType)) < 0)
return nullptr;
@@ -408,7 +408,7 @@ PyTypeObject* createScopedEnum(SbkObjectType* scope, const char* name, const cha
static PyObject* createEnumItem(PyTypeObject* enumType, const char* itemName, long itemValue)
{
PyObject* enumItem = newItem(enumType, itemValue, itemName);
- if (PyDict_SetItemString(PepType(enumType)->tp_dict, itemName, enumItem) < 0)
+ if (PyDict_SetItemString(enumType->tp_dict, itemName, enumItem) < 0)
return 0;
Py_DECREF(enumItem);
return enumItem;
@@ -435,7 +435,7 @@ bool createScopedEnumItem(PyTypeObject *enumType, PyTypeObject *scope,
const char *itemName, long itemValue)
{
if (PyObject *enumItem = createEnumItem(enumType, itemName, itemValue)) {
- if (PyDict_SetItemString(PepType(scope)->tp_dict, itemName, enumItem) < 0)
+ if (PyDict_SetItemString(reinterpret_cast<PyTypeObject *>(scope)->tp_dict, itemName, enumItem) < 0)
return false;
Py_DECREF(enumItem);
return true;
@@ -470,10 +470,10 @@ newItem(PyTypeObject *enumType, long itemValue, const char *itemName)
enumObj->ob_value = itemValue;
if (newValue) {
- PyObject* values = PyDict_GetItemString(PepType(enumType)->tp_dict, const_cast<char*>("values"));
+ PyObject* values = PyDict_GetItemString(enumType->tp_dict, const_cast<char*>("values"));
if (!values) {
values = PyDict_New();
- PyDict_SetItemString(PepType(enumType)->tp_dict, const_cast<char*>("values"), values);
+ PyDict_SetItemString(enumType->tp_dict, const_cast<char*>("values"), values);
Py_DECREF(values); // ^ values still alive, because setitemstring incref it
}
PyDict_SetItemString(values, itemName, reinterpret_cast<PyObject*>(enumObj));
@@ -660,7 +660,7 @@ DeclaredEnumTypes::~DeclaredEnumTypes()
* So right now I am doing nothing. Surely wrong but no crash.
* See also the comment in function 'createGlobalEnumItem'.
*/
- //fprintf(stderr, "ttt %d %s\n", Py_REFCNT(*it), PepType(*it)->tp_name);
+ //fprintf(stderr, "ttt %d %s\n", Py_REFCNT(*it), *it->tp_name);
}
m_enumTypes.clear();
}
diff --git a/sources/shiboken2/libshiboken/signature.cpp b/sources/shiboken2/libshiboken/signature.cpp
index fc83f89cd..df49a4d29 100644
--- a/sources/shiboken2/libshiboken/signature.cpp
+++ b/sources/shiboken2/libshiboken/signature.cpp
@@ -187,7 +187,7 @@ static int
build_qualname_to_func(PyObject *obtype)
{
PyTypeObject *type = (PyTypeObject *)obtype;
- PyMethodDef *meth = PepType(type)->tp_methods;
+ PyMethodDef *meth = type->tp_methods;
if (meth == 0)
return 0;
@@ -477,7 +477,7 @@ error:
static int
add_more_getsets(PyTypeObject *type, PyGetSetDef *gsp)
{
- PyObject *dict = PepType(type)->tp_dict;
+ PyObject *dict = type->tp_dict;
for (; gsp->name != NULL; gsp++) {
PyObject *descr;
@@ -593,8 +593,8 @@ static int
build_func_to_type(PyObject *obtype)
{
PyTypeObject *type = (PyTypeObject *)obtype;
- PyObject *dict = PepType(type)->tp_dict;
- PyMethodDef *meth = PepType(type)->tp_methods;
+ PyObject *dict = type->tp_dict;
+ PyMethodDef *meth = type->tp_methods;
if (meth == 0)
return 0;
diff --git a/sources/shiboken2/libshiboken/voidptr.cpp b/sources/shiboken2/libshiboken/voidptr.cpp
index 94c667598..3a0dbb434 100644
--- a/sources/shiboken2/libshiboken/voidptr.cpp
+++ b/sources/shiboken2/libshiboken/voidptr.cpp
@@ -59,8 +59,8 @@ PyObject *SbkVoidPtrObject_new(PyTypeObject *type, PyObject *args, PyObject *kwd
// type cast than to do everything in one line. The bad construct looked
// like this, actual call forgotten:
// SbkVoidPtrObject *self =
- // reinterpret_cast<SbkVoidPtrObject *>(PepType(type)->tp_alloc);
- PyObject *ob = PepType(type)->tp_alloc(type, 0);
+ // reinterpret_cast<SbkVoidPtrObject *>(type->tp_alloc);
+ PyObject *ob = type->tp_alloc(type, 0);
SbkVoidPtrObject *self = reinterpret_cast<SbkVoidPtrObject *>(ob);
if (self != 0) {
@@ -194,7 +194,7 @@ PyObject *SbkVoidPtrObject_repr(PyObject *v)
SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
PyObject *s = PyBytes_FromFormat("%s(%p, %zd, %s)",
- PepType((Py_TYPE(sbkObject)))->tp_name,
+ Py_TYPE(sbkObject)->tp_name,
sbkObject->cptr,
sbkObject->size,
sbkObject->isWritable ? trueString : falseString);
@@ -206,7 +206,7 @@ PyObject *SbkVoidPtrObject_str(PyObject *v)
{
SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
PyObject *s = PyBytes_FromFormat("%s(Address %p, Size %zd, isWritable %s)",
- PepType((Py_TYPE(sbkObject)))->tp_name,
+ Py_TYPE(sbkObject)->tp_name,
sbkObject->cptr,
sbkObject->size,
sbkObject->isWritable ? trueString : falseString);
diff --git a/sources/shiboken2/tests/samplebinding/typesystem_sample.xml b/sources/shiboken2/tests/samplebinding/typesystem_sample.xml
index 5f0a9206b..00052e881 100644
--- a/sources/shiboken2/tests/samplebinding/typesystem_sample.xml
+++ b/sources/shiboken2/tests/samplebinding/typesystem_sample.xml
@@ -1666,7 +1666,7 @@
Tested in InjectCodeTest.testTypeNativeBeginning_TypeTargetBeginning:
-->
<inject-code class="target" position="beginning">
- PepType(&amp;%PYTHONTYPEOBJECT)->tp_str = InjectCode_tpstr;
+ %PYTHONTYPEOBJECT.tp_str = InjectCode_tpstr;
</inject-code>
<!-- Tested in InjectCodeTest.testFunctionTargetBeginning_FunctionTargetEnd -->
@@ -2178,7 +2178,7 @@
</add-function>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
- ByteArray b(PepType(Py_TYPE(%PYSELF))->tp_name);
+ ByteArray b(Py_TYPE(%PYSELF)->tp_name);
PyObject* aux = Shiboken::String::fromStringAndSize(%CPPSELF.data(), %CPPSELF.size());
if (PyUnicode_CheckExact(aux)) {
PyObject* tmp = PyUnicode_AsASCIIString(aux);