Mercurial > octave
changeset 32438:a7a769c02a27
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
author | Petter T. <petter.vilhelm@gmail.com> |
---|---|
date | Fri, 27 Oct 2023 18:19:20 +0200 |
parents | fcc5a0b0e564 |
children | e77f4f571c73 |
files | libinterp/parse-tree/pt-bytecode-vm.cc |
diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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: