Only raise exception if no wrapped object if actually need to access it, else have issues in __new__() of derived class.
This commit is contained in:
@@ -1013,11 +1013,6 @@ static PyObject *WraptObjectProxy_getattro(
|
||||
{
|
||||
PyObject *object = NULL;
|
||||
|
||||
if (!self->wrapped) {
|
||||
PyErr_SetString(PyExc_ValueError, "wrapper has not been initialised");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
object = PyObject_GenericGetAttr((PyObject *)self, name);
|
||||
|
||||
if (object)
|
||||
@@ -1025,6 +1020,11 @@ static PyObject *WraptObjectProxy_getattro(
|
||||
|
||||
PyErr_Clear();
|
||||
|
||||
if (!self->wrapped) {
|
||||
PyErr_SetString(PyExc_ValueError, "wrapper has not been initialised");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return PyObject_GetAttr(self->wrapped, name);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user