Branch: Tag:

2000-12-02

2000-12-02 16:21:36 by Martin Stjernholm <mast@lysator.liu.se>

Improved the error reporting fallback in handle_error. Fixed some
checks for zero values to avoid calling any function in them in case
they're objects (i.e. neither `== nor `!). This fixes [bug 844 (#844)].

Rev: lib/master.pike.in:1.136

1:   /* -*- Pike -*-    * -  * $Id: master.pike.in,v 1.135 2000/11/20 01:26:26 mast Exp $ +  * $Id: master.pike.in,v 1.136 2000/12/02 16:21:36 mast Exp $    *    * Master-file for Pike.    *
469:    // tune up the STACK_MARGIN values in interpret.c then.    werror("Error in handle_error in master object:\n");    if(catch { +  if (catch { +  string msg = x[0]; +  array bt = x[1]; +  werror ("%s%O\nOriginal error:\n%O\n", msg, bt, trace); +  })    werror("%O\nOriginal error:\n%O\n",x,trace);    }) {    werror("sprintf() failed to write error.\n");
660:    mixed ret;    if(!zero_type(ret=cache[index]))    { -  if(ret!=0) return ret; +  // The check below is to (hopefully) avoid calling any function +  // in ret (like `! or `==) in case it's an object. +  if(!intp (ret) || ret) return ret;    return UNDEFINED;    }    return cache[index]=ind(index);
709:    {    // werror("indices(%O) called\n", dirname);    fill_cache(); -  return indices(filter(cache, lambda(mixed x){ return x!=0; })); +  return indices(filter(cache, lambda(mixed x){ return !intp (x) || x; }));    }    array(mixed) _values()    {
1754:    if (catch (name = function_name (f))) name = "function";       object o = function_object(f); -  if(o != 0) { // Testing simply on o here could invoke a `!. +  if(objectp (o)) { // Check if it's an object in a way that (hopefully) doesn't +  // call any functions in it (neither `== nor `!).    string s;    if (!catch (s = sprintf("%O",o)) && s != "object")    return s+"->"+name;