# HG changeset patch # User Petter T. # Date 1698423560 -7200 # Fri Oct 27 18:19:20 2023 +0200 # Node ID 4c643f660de4c4580f5ee57c7e631ca519250db0 # Parent 90f868cc854c0ee94bd87ccc8bb4e395c5ea4b51 Swallow echo_code() exception on nameless functions in bytecode interpreter Workaround for possible weakness in how echo works. E.g.: function h = t() h = @() 1 + 1; h() end Does not echo '1 + 1' since there is no echo () call in the tree_evaluator for anon. function calls. * pt-bytecode-vm.cc: Swallow exception diff -r 90f868cc854c -r 4c643f660de4 libinterp/parse-tree/pt-bytecode-vm.cc --- a/libinterp/parse-tree/pt-bytecode-vm.cc Fri Oct 27 18:19:14 2023 +0200 +++ b/libinterp/parse-tree/pt-bytecode-vm.cc Fri Oct 27 18:19:20 2023 +0200 @@ -6167,7 +6167,19 @@ m_tw->set_echo_file_pos (line); } - m_tw->echo_code (line); + try + { + m_tw->echo_code (line); + } + catch (execution_exception &) + { + // echo_code() might throw if there is no file info + // attached to the executing function. + // Just ignore it. + // TODO: Might be a bug? Does this apply to the tree_evaluator? + // Run "echo on all; test bytecode.tst" to recreate. + } + m_tw->set_echo_file_pos (line + 1); } bail_echo: