Merge pull request #304 from trygvis/pybind-303

Changes accessor::operator=() to throw error_already_set() instead of using pybind11_fail().
This commit is contained in:
Wenzel Jakob 2016-08-01 23:10:00 +02:00 committed by GitHub
commit f5d00105ce
1 changed files with 2 additions and 2 deletions

View File

@ -117,10 +117,10 @@ public:
void operator=(const handle &value) { void operator=(const handle &value) {
if (attr) { if (attr) {
if (PyObject_SetAttr(obj.ptr(), key.ptr(), value.ptr()) == -1) if (PyObject_SetAttr(obj.ptr(), key.ptr(), value.ptr()) == -1)
pybind11_fail("Unable to set object attribute"); throw error_already_set();
} else { } else {
if (PyObject_SetItem(obj.ptr(), key.ptr(), value.ptr()) == -1) if (PyObject_SetItem(obj.ptr(), key.ptr(), value.ptr()) == -1)
pybind11_fail("Unable to set object item"); throw error_already_set();
} }
} }