[ruby-bugs-12398] Redefining Exception#backtrace and unhandl

[email protected]$G$9!#e(B

http://rubyforge.org/tracker/index.php?func=detail&aid=12398&group_id=426&atid=1698
e$B$N7o!“e(Bbacktracee$B$r%;%C%H$9$k$H$-$K$O%A%’%C%/$7$F$$$k$1$l$I!”<h$je(B
e$B=P$9$H$-$K$O3NG’$7$F$J$$$+$i$G$9$,!"$I$C$A$,$$$$$G$7$g$&!#e(B

(1) e$B<h$j=P$7$?8e$G%A%’%C%/$9$ke(B
(2) rb_funcalle$B$r;H$o$:e(Bexc_backtrace()e$B$GD>@<h$j=P$9e(B

e$BMW$9$k$K!“e(BException#backtracee$B$r%5%V%/%i%9$G%*!<%P!<%i%$%I$9$k$3e(B
e$B$H$rA[Dj$9$k$+$I$&$+!”$G$9$,!#e(B

e$B$H$j$"$($:e(B(1)e$B$N%Q%C%A$G$9!#e(B

Index: error.c

— error.c (revision 12814)
+++ error.c (working copy)
@@ -496,12 +496,12 @@ static VALUE
exc_backtrace(VALUE exc)
{

  • ID bt = rb_intern(“bt”);
  • static ID bt;
  • if (!rb_ivar_defined(exc, bt)) return Qnil;
  • return rb_ivar_get(exc, bt);
  • if (!bt) bt = rb_intern(“bt”);
  • return rb_attr_get(exc, bt);
    }

-static VALUE
-check_backtrace(VALUE bt)
+VALUE
+rb_check_backtrace(VALUE bt)
{
long i;
@@ -537,5 +537,5 @@ static VALUE
exc_set_backtrace(VALUE exc, VALUE bt)
{

  • return rb_iv_set(exc, “bt”, check_backtrace(bt));
  • return rb_iv_set(exc, “bt”, rb_check_backtrace(bt));
    }

Index: eval_error.ci

— eval_error.ci (revision 12814)
+++ eval_error.ci (working copy)
@@ -67,4 +67,6 @@ error_pos(void)
}

+VALUE rb_check_backtrace(VALUE);
+
static VALUE
get_backtrace(VALUE info)
@@ -75,5 +77,5 @@ get_backtrace(VALUE info)
if (NIL_P(info))
return Qnil;

  • return rb_check_array_type(info);
  • return rb_check_backtrace(info);
    }

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:31261] [ruby-bugs-12398] Redefining
Exception#backtrace and unhandled exception bug”
on Thu, 19 Jul 2007 16:10:43 +0900, Nobuyoshi N.
[email protected] writes:

|(1) e$B<h$j=P$7$?8e$G%A%’%C%/$9$ke(B
|(2) rb_funcalle$B$r;H$o$:e(Bexc_backtrace()e$B$GD>@<h$j=P$9e(B
|
|e$BMW$9$k$K!“e(BException#backtracee$B$r%5%V%/%i%9$G%*!<%P!<%i%$%I$9$k$3e(B
|e$B$H$rA[Dj$9$k$+$I$&$+!”$G$9$,!#e(B

(1)e$B$NJ}$,NI$$$G$7$g$&$M!#%3%_%C%H$7$F$/[email protected]$5$$$^$;$s$+!#e(B