Skip to content

Commit

Permalink
Callback return generic error if python exception is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
igo95862 committed Jun 13, 2022
1 parent 2e05403 commit 1f9a27e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/sdbus/sd_bus_internals_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ PyType_Spec SdBusInterfaceType = {
static int set_dbus_error_from_python_exception(sd_bus_error* ret_error) {
PyObject* current_exception = PyErr_Occurred();
if (NULL == current_exception) {
return 0;
goto fail;
}
#ifdef Py_LIMITED_API
PyObject* dbus_error_bytes CLEANUP_PY_OBJECT = NULL;
Expand Down
10 changes: 10 additions & 0 deletions test/test_low_level_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,13 @@ async def test_property_setter_derived_error(self) -> None:
)

await self.test_object_connection.hello_world()

async def test_property_callback_error(self) -> None:
interface = self.test_object._activated_interfaces[0]
interface.property_get_dict.pop(b'DerriveErrSettable')

with self.assertRaises(DbusFailedError):
await wait_for(
self.test_object_connection.derrive_err_settable,
timeout=1,
)

0 comments on commit 1f9a27e

Please sign in to comment.