Skip to content

Commit 1f9a27e

Browse files
committed
Callback return generic error if python exception is not set
1 parent 2e05403 commit 1f9a27e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/sdbus/sd_bus_internals_interface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ PyType_Spec SdBusInterfaceType = {
355355
static int set_dbus_error_from_python_exception(sd_bus_error* ret_error) {
356356
PyObject* current_exception = PyErr_Occurred();
357357
if (NULL == current_exception) {
358-
return 0;
358+
goto fail;
359359
}
360360
#ifdef Py_LIMITED_API
361361
PyObject* dbus_error_bytes CLEANUP_PY_OBJECT = NULL;

test/test_low_level_errors.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,13 @@ async def test_property_setter_derived_error(self) -> None:
162162
)
163163

164164
await self.test_object_connection.hello_world()
165+
166+
async def test_property_callback_error(self) -> None:
167+
interface = self.test_object._activated_interfaces[0]
168+
interface.property_get_dict.pop(b'DerriveErrSettable')
169+
170+
with self.assertRaises(DbusFailedError):
171+
await wait_for(
172+
self.test_object_connection.derrive_err_settable,
173+
timeout=1,
174+
)

0 commit comments

Comments
 (0)