Mercurial > octave
changeset 25463:1c4ffd4f9404 stable
create valid tmp scope for who -file (bug #54030)
* variables.cc (do_who): Provide name to symbol_scope contstructor to
create valid scope.
(Fwho): New test.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 12 Jun 2018 15:06:19 -0400 |
parents | 265d3a59da27 |
children | c0bca26d0713 f09f7c7815e3 |
files | libinterp/corefcn/variables.cc |
diffstat | 1 files changed, 19 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/variables.cc Tue Jun 12 11:25:46 2018 -0700 +++ b/libinterp/corefcn/variables.cc Tue Jun 12 15:06:19 2018 -0400 @@ -1663,7 +1663,7 @@ // Set up temporary scope. - octave::symbol_scope tmp_scope; + octave::symbol_scope tmp_scope ("$dummy_scope$"); symtab.set_scope (tmp_scope); @@ -1868,6 +1868,24 @@ return do_who (interp, argc, argv, nargout == 1); } +/* +%!test +%! avar = magic (4); +%! ftmp = [tempname() ".mat"]; +%! unwind_protect +%! save (ftmp, "avar"); +%! vars = whos ("-file", ftmp); +%! assert (numel (vars), 1); +%! assert (isstruct (vars)); +%! assert (vars.name, "avar"); +%! assert (vars.size, [4, 4]); +%! assert (vars.class, "double"); +%! assert (vars.bytes, 128); +%! unwind_protect_cleanup +%! unlink (ftmp); +%! end_unwind_protect +*/ + DEFMETHOD (whos, interp, args, nargout, doc: /* -*- texinfo -*- @deftypefn {} {} whos