diff options
author | Christian Tismer <tismer@stackless.com> | 2018-07-19 21:00:30 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2018-07-23 16:32:01 +0000 |
commit | e24392c76e5cfdd2d6d51bd853b106db2bc4cb80 (patch) | |
tree | 985048135d3a6a81da2f5a72b667ff59ed4d0b44 /sources/shiboken2/libshiboken/pep384impl.cpp | |
parent | 5d21980ba4bd605ccbf4278e75177ae2c144bdd8 (diff) |
Pep 384 Final Cut: Remove PepType
While trying to document the Limited API Project,
it suddenly struck me:
We can make the patch much much simpler and implement it
without the necessity to have an extra PepType!
Now I am happy to continue the documentation, because
it is now no more improvable.
This version will last as long as the layout of
PyTypeObject does not change substantially. When that
happens, then we need to rewrite stuff with the according
PyType_GetSlot() access functions.
These access functions will until then be complete enough
so that we can live without the tricks like inventing a reduced
PyTypeObject as was done in the current implementation.
Task-number: PYSIDE-560
Change-Id: I49849cc377baa6794a5b53292691e21d6e2853ab
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/libshiboken/pep384impl.cpp')
-rw-r--r-- | sources/shiboken2/libshiboken/pep384impl.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
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; |