aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/libpyside/pysideclassinfo.cpp
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2022-01-17 13:20:46 +0100
committerChristian Tismer <tismer@stackless.com>2022-02-03 18:18:04 +0100
commit5a487a6f9f9861fc14458c770e61c66a63019184 (patch)
tree9af8ca3015ae585905a14bb5597f6309472c7b63 /sources/pyside6/libpyside/pysideclassinfo.cpp
parentac1dbba1798bc72cf4e71142ec6f647b8b6ae25d (diff)
PyPySide: Rename interface functions and classes to simplify debugging
The names of certain interface functions are not always following a simple scheme. Especially it is not easy to see immediately if we are dealing with a method of SbkObjectType or SbkObject Do a few renamings to simplify debugging and make the code easier to understand. When a function is used in a type spec and there is no other important reason, it should be named like {Py_<tpname>: reinterpret_cast<void *>(<TypeName>_<tpname>)}, Rename also all type functions ending on "TypeF()" to end in "_TypeF()". This is not always the case. Examples: SbkObjectTpNew -> SbkObject_tp_new SbkObjecttypeTpNew -> SbkObjectType_tp_new PyClassPropertyTypeF -> PyClassProperty_TypeF Task-number: PYSIDE-535 Change-Id: Icbd118852f2ee732b55d944ed57c7a8ef7d26139 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/pysideclassinfo.cpp')
-rw-r--r--sources/pyside6/libpyside/pysideclassinfo.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/sources/pyside6/libpyside/pysideclassinfo.cpp b/sources/pyside6/libpyside/pysideclassinfo.cpp
index beb2d6150..0d0426f86 100644
--- a/sources/pyside6/libpyside/pysideclassinfo.cpp
+++ b/sources/pyside6/libpyside/pysideclassinfo.cpp
@@ -50,16 +50,16 @@
extern "C"
{
-static PyObject *classInfoTpNew(PyTypeObject *subtype, PyObject *args, PyObject *kwds);
-static int classInfoTpInit(PyObject *, PyObject *, PyObject *);
-static void classInfoFree(void *);
-static PyObject *classCall(PyObject *, PyObject *, PyObject *);
+static PyObject *classInfo_tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);
+static int classInfo_tp_init(PyObject *, PyObject *, PyObject *);
+static void classInfo_tp_free(void *);
+static PyObject *classInfo_tp_call(PyObject *, PyObject *, PyObject *);
static PyType_Slot PySideClassInfoType_slots[] = {
- {Py_tp_call, reinterpret_cast<void *>(classCall)},
- {Py_tp_init, reinterpret_cast<void *>(classInfoTpInit)},
- {Py_tp_new, reinterpret_cast<void *>(classInfoTpNew)},
- {Py_tp_free, reinterpret_cast<void *>(classInfoFree)},
+ {Py_tp_call, reinterpret_cast<void *>(classInfo_tp_call)},
+ {Py_tp_init, reinterpret_cast<void *>(classInfo_tp_init)},
+ {Py_tp_new, reinterpret_cast<void *>(classInfo_tp_new)},
+ {Py_tp_free, reinterpret_cast<void *>(classInfo_tp_free)},
{Py_tp_dealloc, reinterpret_cast<void *>(Sbk_object_dealloc)},
{0, nullptr}
};
@@ -72,13 +72,13 @@ static PyType_Spec PySideClassInfoType_spec = {
};
-PyTypeObject *PySideClassInfoTypeF(void)
+PyTypeObject *PySideClassInfo_TypeF(void)
{
static auto *type = SbkType_FromSpec(&PySideClassInfoType_spec);
return type;
}
-PyObject *classCall(PyObject *self, PyObject *args, PyObject * /* kw */)
+PyObject *classInfo_tp_call(PyObject *self, PyObject *args, PyObject * /* kw */)
{
if (!PyTuple_Check(args) || PyTuple_Size(args) != 1) {
PyErr_Format(PyExc_TypeError,
@@ -123,7 +123,7 @@ PyObject *classCall(PyObject *self, PyObject *args, PyObject * /* kw */)
return klass;
}
-static PyObject *classInfoTpNew(PyTypeObject *subtype, PyObject * /* args */, PyObject * /* kwds */)
+static PyObject *classInfo_tp_new(PyTypeObject *subtype, PyObject * /* args */, PyObject * /* kwds */)
{
PySideClassInfo *me = reinterpret_cast<PySideClassInfo *>(subtype->tp_alloc(subtype, 0));
me->d = new PySideClassInfoPrivate;
@@ -133,7 +133,7 @@ static PyObject *classInfoTpNew(PyTypeObject *subtype, PyObject * /* args */, Py
return reinterpret_cast<PyObject *>(me);
}
-int classInfoTpInit(PyObject *self, PyObject *args, PyObject *kwds)
+int classInfo_tp_init(PyObject *self, PyObject *args, PyObject *kwds)
{
PyObject *infoDict = nullptr;
auto size = PyTuple_Size(args);
@@ -174,7 +174,7 @@ int classInfoTpInit(PyObject *self, PyObject *args, PyObject *kwds)
return PyErr_Occurred() ? -1 : 0;
}
-void classInfoFree(void *self)
+void classInfo_tp_free(void *self)
{
auto pySelf = reinterpret_cast<PyObject *>(self);
auto data = reinterpret_cast<PySideClassInfo *>(self);
@@ -195,17 +195,17 @@ static const char *ClassInfo_SignatureStrings[] = {
void init(PyObject *module)
{
- if (InitSignatureStrings(PySideClassInfoTypeF(), ClassInfo_SignatureStrings) < 0)
+ if (InitSignatureStrings(PySideClassInfo_TypeF(), ClassInfo_SignatureStrings) < 0)
return;
- Py_INCREF(PySideClassInfoTypeF());
- PyModule_AddObject(module, "ClassInfo", reinterpret_cast<PyObject *>(PySideClassInfoTypeF()));
+ Py_INCREF(PySideClassInfo_TypeF());
+ PyModule_AddObject(module, "ClassInfo", reinterpret_cast<PyObject *>(PySideClassInfo_TypeF()));
}
bool checkType(PyObject *pyObj)
{
if (pyObj)
- return PyType_IsSubtype(Py_TYPE(pyObj), PySideClassInfoTypeF());
+ return PyType_IsSubtype(Py_TYPE(pyObj), PySideClassInfo_TypeF());
return false;
}