Skip to content

Commit

Permalink
* array.c (get_inspect_tbl): check whether inspect_tbl value is a
Browse files Browse the repository at this point in the history
  valid array. (ruby-bugs-ja PR#65)

* array.c (inspect_ensure,rb_protect_inspect,rb_inspecting_p):
  use get_inspect_tbl().

* eval.c (rb_f_abort): call exit(1) if exception is raised.  This
  patch was made by Nobuyoshi Nakada <[email protected]> on
  2002-05-30.  (ruby-bugs-ja PR#236)

* signal.c: disable Ruby's interrupt handler at the beginning.
  (ruby-bugs-ja PR#236)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed May 19, 2003
1 parent f509843 commit f4ff7cc
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 10 deletions.
17 changes: 17 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@ Mon May 19 08:08:51 2003 Tadayoshi Funaba <[email protected]>

* sample/cal.rb: ditto.

Sat May 17 12:02:25 2003 Yukihiro Matsumoto <[email protected]>

* array.c (get_inspect_tbl): check whether inspect_tbl value is a
valid array. (ruby-bugs-ja PR#65)

* array.c (inspect_ensure,rb_protect_inspect,rb_inspecting_p):
use get_inspect_tbl().

Sat May 17 11:50:26 2003 Yukihiro Matsumoto <[email protected]>

* eval.c (rb_f_abort): call exit(1) if exception is raised. This
patch was made by Nobuyoshi Nakada <[email protected]> on
2002-05-30. (ruby-bugs-ja PR#236)

* signal.c: disable Ruby's interrupt handler at the beginning.
(ruby-bugs-ja PR#236)

Sat May 17 02:17:42 2003 Nobuyoshi Nakada <[email protected]>

* lib/rational.rb (Integer::denominator): fixed typo.
Expand Down
34 changes: 26 additions & 8 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -929,14 +929,36 @@ inspect_call(arg)
return (*arg->func)(arg->arg1, arg->arg2);
}

static VALUE
get_inspect_tbl(create)
int create;
{
VALUE inspect_tbl = rb_thread_local_aref(rb_thread_current(), inspect_key);

if (create && NIL_P(inspect_tbl)) {
tbl_init:
inspect_tbl = rb_ary_new();
rb_thread_local_aset(rb_thread_current(), inspect_key, inspect_tbl);
}
else if (TYPE(inspect_tbl) != T_ARRAY) {
rb_warn("invalid inspect_tbl value");
if (create) goto tbl_init;
rb_thread_local_aset(rb_thread_current(), inspect_key, Qnil);
return Qnil;
}
return inspect_tbl;
}

static VALUE
inspect_ensure(obj)
VALUE obj;
{
VALUE inspect_tbl;

inspect_tbl = rb_thread_local_aref(rb_thread_current(), inspect_key);
rb_ary_pop(inspect_tbl);
inspect_tbl = get_inspect_tbl(Qfalse);
if (!NIL_P(inspect_tbl)) {
rb_ary_pop(inspect_tbl);
}
return 0;
}

Expand All @@ -949,11 +971,7 @@ rb_protect_inspect(func, obj, arg)
VALUE inspect_tbl;
VALUE id;

inspect_tbl = rb_thread_local_aref(rb_thread_current(), inspect_key);
if (NIL_P(inspect_tbl)) {
inspect_tbl = rb_ary_new();
rb_thread_local_aset(rb_thread_current(), inspect_key, inspect_tbl);
}
inspect_tbl = get_inspect_tbl(Qtrue);
id = rb_obj_id(obj);
if (rb_ary_includes(inspect_tbl, id)) {
return (*func)(obj, arg);
Expand All @@ -972,7 +990,7 @@ rb_inspecting_p(obj)
{
VALUE inspect_tbl;

inspect_tbl = rb_thread_local_aref(rb_thread_current(), inspect_key);
inspect_tbl = get_inspect_tbl(Qfalse);
if (NIL_P(inspect_tbl)) return Qfalse;
return rb_ary_includes(inspect_tbl, rb_obj_id(obj));
}
Expand Down
6 changes: 5 additions & 1 deletion eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1185,9 +1185,13 @@ ruby_init()
_macruby_init();
#endif
ruby_prog_init();
ALLOW_INTS;
}
POP_TAG();
if (state) error_print();
if (state) {
error_print();
exit(1);
}
POP_SCOPE();
ruby_scope = top_scope;
}
Expand Down
2 changes: 1 addition & 1 deletion signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ static VALUE trap_list[NSIG];
static rb_atomic_t trap_pending_list[NSIG];
rb_atomic_t rb_trap_pending;
rb_atomic_t rb_trap_immediate;
int rb_prohibit_interrupt;
int rb_prohibit_interrupt = 1;

void
rb_gc_mark_trap_list()
Expand Down

0 comments on commit f4ff7cc

Please sign in to comment.