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>
This commit is contained in:
parent
2d5207b32c
commit
6e95894d10
1 changed files with 15 additions and 5 deletions
|
|
@ -255,7 +255,6 @@ int reset(PySideProperty* self, PyObject* source)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* getTypeName(const PySideProperty* self)
|
const char* getTypeName(const PySideProperty* self)
|
||||||
{
|
{
|
||||||
return self->d->typeName;
|
return self->d->typeName;
|
||||||
|
|
@ -263,14 +262,25 @@ const char* getTypeName(const PySideProperty* self)
|
||||||
|
|
||||||
PySideProperty* getObject(PyObject* source, PyObject* name)
|
PySideProperty* getObject(PyObject* source, PyObject* name)
|
||||||
{
|
{
|
||||||
PyObject* attr = PyObject_GenericGetAttr(source, name);
|
PyObject* attr = 0;
|
||||||
if (attr && isPropertyType(attr))
|
|
||||||
|
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);
|
return reinterpret_cast<PySideProperty*>(attr);
|
||||||
|
}
|
||||||
|
|
||||||
if (!attr)
|
if (!attr)
|
||||||
PyErr_Clear(); //Clear possible error caused by PyObject_GenericGetAttr
|
PyErr_Clear(); //Clear possible error caused by PyObject_GenericGetAttr
|
||||||
else
|
|
||||||
Py_DECREF(attr);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue