changeset 29030:ba5a0edff85e

maint: merge stable to default.
author John W. Eaton <jwe@octave.org>
date Thu, 05 Nov 2020 12:40:38 -0500
parents c01950bc7290 (current diff) 7c9a40fb3337 (diff)
children c27ce309c079
files libinterp/corefcn/cellfun.cc libinterp/dldfcn/__init_gnuplot__.cc libinterp/parse-tree/oct-lvalue.cc
diffstat 3 files changed, 29 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/cellfun.cc	Thu Nov 05 18:08:55 2020 +0100
+++ b/libinterp/corefcn/cellfun.cc	Thu Nov 05 12:40:38 2020 -0500
@@ -80,19 +80,20 @@
     {
       tmp = octave::feval (func, inputlist, nargout);
     }
-  catch (const octave::execution_exception& e)
+  catch (const octave::execution_exception& ee)
     {
       if (error_handler.is_defined ())
         {
           octave::interpreter& interp
             = octave::__get_interpreter__ ("get_output_list");
 
+          es.save_exception (ee);
           interp.recover_from_exception ();
 
           execution_error = true;
         }
       else
-        throw e;
+        throw;
     }
 
   if (execution_error)
@@ -987,6 +988,17 @@
 %!error cellfun (@sin, {[]}, "BadParam", false)
 %!error cellfun (@sin, {[]}, "UniformOuput")
 %!error cellfun (@sin, {[]}, "ErrorHandler")
+
+%!function retval = __errfcn (S, varargin)
+%!  global __errmsg;
+%!  __errmsg = S.message;
+%!  retval = NaN;
+%!endfunction
+%!test <58411>
+%! global __errmsg;
+%! assert (cellfun (@factorial, {1, 2, -3}, "ErrorHandler", @__errfcn), [1, 2, NaN]);
+%! assert (! isempty (__errmsg));
+%! clear -global __errmsg;
 */
 
 // Arrayfun was originally a .m file written by Bill Denney and Jaroslav
--- a/libinterp/dldfcn/__init_gnuplot__.cc	Thu Nov 05 18:08:55 2020 +0100
+++ b/libinterp/dldfcn/__init_gnuplot__.cc	Thu Nov 05 12:40:38 2020 -0500
@@ -47,6 +47,8 @@
 #include "defun-dld.h"
 #include "error.h"
 #include "graphics.h"
+#include "interpreter-private.h"
+#include "interpreter.h"
 #include "ov.h"
 #include "ovl.h"
 #include "parse.h"
@@ -211,7 +213,12 @@
         }
     }
   catch (octave::execution_exception&)
-    { }
+    {
+      octave::interpreter& interp
+        = octave::__get_interpreter__ ("have_gnuplot_binary");
+
+      interp.recover_from_exception ();
+    }
 
   return retval;
 }
--- a/libinterp/parse-tree/oct-lvalue.cc	Thu Nov 05 18:08:55 2020 +0100
+++ b/libinterp/parse-tree/oct-lvalue.cc	Thu Nov 05 12:40:38 2020 -0500
@@ -29,6 +29,8 @@
 
 #include "error.h"
 #include "errwarn.h"
+#include "interpreter-private.h"
+#include "interpreter.h"
 #include "ovl.h"
 #include "oct-lvalue.h"
 #include "ov.h"
@@ -235,6 +237,11 @@
         // could happen because there is an index is out of range
         // and we will be resizing a cell array.
 
+        interpreter& interp
+          = __get_interpreter__ ("octave_lvalue::eval_for_numel");
+
+        interp.recover_from_exception ();
+
         retval = octave_value ();
       }