X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Fnative_bt_autodisc.i.h;fp=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Fnative_bt_autodisc.i.h;h=d6a4d24bbe1ae0d3f089ee6639ac8ca081111d43;hp=43e9dc82e534f6e244c6b04c89b1c6f48e14f840;hb=827e42e017fc5f525aa39a3851bf2e7e50e887aa;hpb=dfa664f9be160bace24f960b444818d06e75aeb5 diff --git a/src/bindings/python/bt2/bt2/native_bt_autodisc.i.h b/src/bindings/python/bt2/bt2/native_bt_autodisc.i.h index 43e9dc82..d6a4d24b 100644 --- a/src/bindings/python/bt2/bt2/native_bt_autodisc.i.h +++ b/src/bindings/python/bt2/bt2/native_bt_autodisc.i.h @@ -43,6 +43,7 @@ bt_value *bt_bt2_auto_discover_source_components(const bt_value *inputs, bt_value *components_list = NULL; bt_value *component_info = NULL; bt_value_map_insert_entry_status insert_entry_status; + const bt_error *error = NULL; BT_ASSERT(bt_value_get_type(inputs) == BT_VALUE_TYPE_ARRAY); for (i = 0; i < bt_value_array_get_length(inputs); i++) { @@ -178,11 +179,23 @@ error: end: if (result) { + /* + * If an error happened, we must clear the error temporarily + * while we insert the status in the map. + */ + error = bt_current_thread_take_error(); insert_entry_status = bt_value_map_insert_signed_integer_entry(result, "status", status); - if (insert_entry_status != BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) { + if (insert_entry_status == BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK) { + if (error) { + bt_current_thread_move_error(error); + error = NULL; + } + } else { BT_VALUE_PUT_REF_AND_RESET(result); PyErr_NoMemory(); } + + } auto_source_discovery_fini(&auto_disc); @@ -190,5 +203,9 @@ end: bt_value_put_ref(components_list); bt_value_put_ref(component_info); + if (error) { + bt_error_release(error); + } + return result; }