[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wr
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message |
Date: |
Fri, 6 Nov 2020 17:51:40 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36 |
Follow-up Comment #13, bug #58411 (project octave):
The trouble with the patch is that some functions may return zero arguments
(tmp_len == 0) and this is okay. For example,
cellfun (@(x) disp (x), {1, 2, 3})
1
2
3
With the patch applied, this aborts early
cellfun (@(x) disp (x), {1, 2, 3})
error: cellfun: function must return value when UniformOutput is TRUE
1
The trick is really that Octave needs to detect a deviation from the expected.
In the factorial example,
cellfun ("factorial", {1,2,-3}, "ErrorHandler", @cellfoo)
nargout is 0, but factorial is expected to produce 1 output, which it does for
the first two elements and then the ErrorHandler function does not produce an
output and this should cause an error.
In the disp() example, there should be no outputs but if one output were
returned that would be an error.
One possibility might be to have an expected_nargout variable that is
initialized after calling the function for the first time. After that the
comparison would be between the expected_nargout and the actual number of
arguments from get_output_list.
I've attached a diff for that.
(file #50218)
_______________________________________________________
Additional Item Attachment:
File name: 58411.diff Size:1 KB
<https://file.savannah.gnu.org/file/58411.diff?file_id=50218>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?58411>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message, John W. Eaton, 2020/11/05
- [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message, Muhali, 2020/11/05
- [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message, John W. Eaton, 2020/11/05
- [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message, Rik, 2020/11/05
- [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message, Muhali, 2020/11/06
- [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message, Rik, 2020/11/06
- [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message, Muhali, 2020/11/06
- [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message, John W. Eaton, 2020/11/06
- [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message, John W. Eaton, 2020/11/06
- [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message,
Rik <=
- [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message, Rik, 2020/11/06
- [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message, John W. Eaton, 2020/11/09
- [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message, John W. Eaton, 2020/11/11
- [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message, Rik, 2020/11/11
- [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message, Muhali, 2020/11/12
- [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message, Rik, 2020/11/12