diff options
author | Paulo Alcantara <paulo.alcantara@openbossa.org> | 2011-05-05 16:50:01 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:19 -0300 |
commit | 81d71072792d832b13d4ce7d7574afe8930b7269 (patch) | |
tree | c233255e470b6da5d1ba803405a7f4014f6837e0 /libpyside | |
parent | f05552fc86dc205ca7589a6183872e2e7abfb162 (diff) |
Fix bug #835 - "pyside breaks descriptor protocol"
Signed-off-by: Paulo Alcantara <paulo.alcantara@openbossa.org>
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
Diffstat (limited to 'libpyside')
-rw-r--r-- | libpyside/pysideproperty.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/libpyside/pysideproperty.cpp b/libpyside/pysideproperty.cpp index 4e9b724ea..fb9116557 100644 --- a/libpyside/pysideproperty.cpp +++ b/libpyside/pysideproperty.cpp @@ -255,7 +255,6 @@ int reset(PySideProperty* self, PyObject* source) return -1; } - const char* getTypeName(const PySideProperty* self) { return self->d->typeName; @@ -263,14 +262,25 @@ const char* getTypeName(const PySideProperty* self) PySideProperty* getObject(PyObject* source, PyObject* name) { - PyObject* attr = PyObject_GenericGetAttr(source, name); - if (attr && isPropertyType(attr)) + PyObject* attr = 0; + + if (Shiboken::Object::isUserType(source)) { + PyObject* dict = reinterpret_cast<SbkObject*>(source)->ob_dict; + if (dict) + attr = PyDict_GetItem(dict, name); + } + + if (!attr) + attr = PyDict_GetItem(source->ob_type->tp_dict, name); + + if (attr && isPropertyType(attr)) { + Py_INCREF(attr); return reinterpret_cast<PySideProperty*>(attr); + } if (!attr) PyErr_Clear(); //Clear possible error caused by PyObject_GenericGetAttr - else - Py_DECREF(attr); + return 0; } |