Only raise exception if no wrapped object if actually need to access it to set an attribute.
This commit is contained in:
@@ -1040,11 +1040,6 @@ static int WraptObjectProxy_setattro(
|
||||
|
||||
PyObject *match = NULL;
|
||||
|
||||
if (!self->wrapped) {
|
||||
PyErr_SetString(PyExc_ValueError, "wrapper has not been initialised");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
self_prefix = PyUnicode_FromString("_self_");
|
||||
#else
|
||||
@@ -1077,6 +1072,11 @@ static int WraptObjectProxy_setattro(
|
||||
|
||||
Py_DECREF(attr_wrapped);
|
||||
|
||||
if (!self->wrapped) {
|
||||
PyErr_SetString(PyExc_ValueError, "wrapper has not been initialised");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
attr_name = PyUnicode_FromString("__name__");
|
||||
attr_qualname = PyUnicode_FromString("__qualname__");
|
||||
|
||||
Reference in New Issue
Block a user