mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 22:52:01 +00:00
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:
commit
f5d00105ce
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user