diff options
Diffstat (limited to 'sources/shiboken2/libshiboken')
-rw-r--r-- | sources/shiboken2/libshiboken/basewrapper.cpp | 32 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/basewrapper.h | 2 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/bindingmanager.cpp | 12 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/bufferprocs27.cpp | 2 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/pep384impl.cpp | 22 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/pep384impl.h | 19 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/sbkconverter.cpp | 6 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/sbkenum.cpp | 22 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/signature.cpp | 8 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/voidptr.cpp | 8 |
10 files changed, 63 insertions, 70 deletions
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); |