Improve error handling calling PyObject_SetAttr
Less obscure error when setting 'this' on the SWIG proxy object attempting to override __setattr__ in C++ (swig-user mailing list query 19 Aug 2019).
This commit is contained in:
parent
c48d11ac17
commit
719eea090d
2 changed files with 11 additions and 6 deletions
|
|
@ -69,8 +69,7 @@ namespace swig {
|
|||
static bool back_reference(PyObject* child, PyObject* owner) {
|
||||
SwigPyObject* swigThis = SWIG_Python_GetSwigThis(child);
|
||||
if (swigThis && (swigThis->own & SWIG_POINTER_OWN) != SWIG_POINTER_OWN) {
|
||||
PyObject_SetAttr(child, container_owner_attribute(), owner);
|
||||
return true;
|
||||
return PyObject_SetAttr(child, container_owner_attribute(), owner) != -1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue