octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wstate cleanup


From: Rik
Subject: Re: wstate cleanup
Date: Mon, 22 Dec 2014 14:25:40 -0800


>> 3) Unnecessary changes to m-files?
>>
>> The patch had changes to skewness.m, kurtosis.m, and test.m.  Was this
>> intentional or the result of script search/replace?
>
>Not intentional.  I was planning to check those changes in separately.
>
>> In skewness.m, for example, the original code is
>>
>> ## Verify no "divide-by-zero" warnings
>> %!test
>> %! wstate = warning ("query", "Octave:divide-by-zero");
>> %! warning ("on", "Octave:divide-by-zero");
>> %! unwind_protect
>> %!   lastwarn ("");  # clear last warning
>> %!   skewness (1);
>> %!   assert (lastwarn (), "");
>> %! unwind_protect_cleanup
>> %!   warning (wstate, "Octave:divide-by-zero");
>> %! end_unwind_protect
>>
>> and the delta is
>>
>> --- a/scripts/statistics/base/skewness.m
>> +++ b/scripts/statistics/base/skewness.m
>> @@ -157,7 +157,7 @@
>>   %!   skewness (1);
>>   %!   assert (lastwarn (), "");
>>   %! unwind_protect_cleanup
>> -%!   warning (wstate, "Octave:divide-by-zero");
>> +%!   warning (wstate);
>>   %! end_unwind_protect
>>
>> But this doesn't seem right, because wstate will be "on" or "off", not a
>> structure of all the preserved values.
>
>Then there is a different bug because I'm currently seeing this:
>
>octave:1> warning ("query", "Octave:str-to-num")
>ans =
>
>  scalar structure containing the fields:
>
>    identifier = Octave:str-to-num
>    state = off
>
>If it is supposed to just return a string then I guess it has been broken for a while since I also see this behavior for 3.8.2.
>


My bad.  The warning function has always returned a structure.  The cleanup you propose is definitely correct.

--Rik


reply via email to

[Prev in Thread] Current Thread [Next in Thread]