Mercurial > octave
comparison libinterp/parse-tree/pt-eval.cc @ 32891:ff1d5873f805 stable
don't allow anon fcn eval to return comma-separated list (bug #64783)
* pt-eval.cc (tree_evaluator::execute_user_function): If evaluation of
an anonymous function (special_expr) results in a comma-separated
list, return the first element of the list, not the comma-separated
list itself.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 31 Jan 2024 17:28:04 -0500 |
parents | cb3163ba60c1 |
children | 9104b087dc26 cf43680cd221 |
comparison
equal
deleted
inserted
replaced
32890:258444f64447 | 32891:ff1d5873f805 |
---|---|
3676 if (expr) | 3676 if (expr) |
3677 { | 3677 { |
3678 m_call_stack.set_location (stmt->line (), stmt->column ()); | 3678 m_call_stack.set_location (stmt->line (), stmt->column ()); |
3679 | 3679 |
3680 retval = expr->evaluate_n (*this, nargout); | 3680 retval = expr->evaluate_n (*this, nargout); |
3681 | |
3682 // Don't allow a comma-separated list to escape (see bug #64783). | |
3683 | |
3684 if (nargout <= 1 && retval.length () == 1 && retval(0).is_cs_list ()) | |
3685 retval = retval(0).list_value (); | |
3681 } | 3686 } |
3682 } | 3687 } |
3683 else | 3688 else |
3684 cmd_list->accept (*this); | 3689 cmd_list->accept (*this); |
3685 | 3690 |