From c39a7cac8767d91dbe98c959edeb68d05071b4b3 Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Sat, 1 Aug 2020 14:29:45 +0200 Subject: Do some cleanup to pysideproperty.cpp and feature select Change-Id: Id7e1a4f9f938f9b86e1e905936b78c1531f5a566 Reviewed-by: Friedemann Kleint --- sources/pyside2/libpyside/pysideproperty.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'sources/pyside2/libpyside/pysideproperty.cpp') diff --git a/sources/pyside2/libpyside/pysideproperty.cpp b/sources/pyside2/libpyside/pysideproperty.cpp index 85db745ae..433615e10 100644 --- a/sources/pyside2/libpyside/pysideproperty.cpp +++ b/sources/pyside2/libpyside/pysideproperty.cpp @@ -73,7 +73,7 @@ static PyMethodDef PySidePropertyMethods[] = { }; static PyGetSetDef PySidePropertyType_getset[] = { - {"__doc__", qPropertyDocGet, nullptr, nullptr, nullptr}, + {const_cast("__doc__"), qPropertyDocGet, nullptr, nullptr, nullptr}, {nullptr, nullptr, nullptr, nullptr, nullptr} }; @@ -167,7 +167,7 @@ static PyObject *qpropertyTpNew(PyTypeObject *subtype, PyObject * /* args */, Py return reinterpret_cast(me); } -int qpropertyTpInit(PyObject *self, PyObject *args, PyObject *kwds) +static int qpropertyTpInit(PyObject *self, PyObject *args, PyObject *kwds) { PyObject *type = nullptr; auto data = reinterpret_cast(self); @@ -218,7 +218,7 @@ int qpropertyTpInit(PyObject *self, PyObject *args, PyObject *kwds) return -1; } -void qpropertyDeAlloc(PyObject *self) +static void qpropertyDeAlloc(PyObject *self) { qpropertyClear(self); if (PepRuntime_38_flag) { @@ -229,7 +229,7 @@ void qpropertyDeAlloc(PyObject *self) Py_TYPE(self)->tp_free(self); } -PyObject *qPropertyCall(PyObject *self, PyObject *args, PyObject * /* kw */) +static PyObject *qPropertyCall(PyObject *self, PyObject *args, PyObject * /* kw */) { PyObject *callback = PyTuple_GetItem(args, 0); if (PyFunction_Check(callback)) { @@ -246,7 +246,7 @@ PyObject *qPropertyCall(PyObject *self, PyObject *args, PyObject * /* kw */) return nullptr; } -PyObject *qPropertySetter(PyObject *self, PyObject *callback) +static PyObject *qPropertySetter(PyObject *self, PyObject *callback) { if (PyFunction_Check(callback)) { PySideProperty *prop = reinterpret_cast(self); @@ -262,7 +262,7 @@ PyObject *qPropertySetter(PyObject *self, PyObject *callback) return nullptr; } -PyObject *qPropertyGetter(PyObject *self, PyObject *callback) +static PyObject *qPropertyGetter(PyObject *self, PyObject *callback) { if (PyFunction_Check(callback)) { PySideProperty *prop = reinterpret_cast(self); @@ -291,8 +291,7 @@ static PyObject *qPropertyDocGet(PyObject *self, void *) return PyString_FromString(doc); #endif } - Py_INCREF(Py_None); - return Py_None; + Py_RETURN_NONE; } @@ -433,11 +432,6 @@ PySideProperty *getObject(PyObject *source, PyObject *name) { PyObject *attr = nullptr; - if (Shiboken::Object::isUserType(source)) { - if (auto dict = reinterpret_cast(source)->ob_dict) - attr = PyDict_GetItem(dict, name); - } - attr = getFromType(Py_TYPE(source), name); if (attr && checkType(attr)) { Py_INCREF(attr); -- cgit v1.2.3