[Bug #2208] Exception#inspect $B$N(B message $BIt$,(B inspect $B$5$l$F$$$J$$(B

Bug #2208: Exception#inspect e$B$Ne(B message e$BIt$,e(B inspect
e$B$5$l$F$$$J$$e(B
http://redmine.ruby-lang.org/issues/show/2208

e$B5/I<<Te(B: Yui NARUSE
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
e$B%+%F%4%je(B: core
ruby -v: ruby 1.9.2dev (2009-10-13 trunk 25324) [x86_64-freebsd7.2]

e$BDL>oe(B Object#inspect e$B$N7k2L$K$G$F$/$kJ8;zNs$Oe(B inspect
e$B$5$l$F$$$^$9!#e(B
e$B$7$+$7!"e(BException#inspect e$B$O$=$N$^$^$K$J$C$F$$$^$9!#e(B

class Foo;def initialize;@a=“\t”;end;end
Foo.new.inspect #=> #<Foo:0x000008012dffd8 @a=“\t”>

Exception.new(“\t”) #=> #<Exception: “\t”>

e$BC1$J$k$+$1K:$l$J5$$,$9$k$N$G$9$,$I$&$G$7$g$&!#e(B

diff --git a/error.c b/error.c
index a7342de…3a5580a 100644
— a/error.c
+++ b/error.c
@@ -458,7 +458,7 @@ exc_exception(int argc, VALUE *argv, VALUE self)
static VALUE
exc_to_s(VALUE exc)
{

  • VALUE mesg = rb_attr_get(exc, rb_intern(“mesg”));
  • VALUE mesg = rb_inspect(rb_attr_get(exc, rb_intern(“mesg”)));

    if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
    if (OBJ_TAINTED(exc)) OBJ_TAINT(mesg);

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

In message “Re: [ruby-dev:39483] [Bug #2208] Exception#inspect
e$B$Ne(B message e$BIt$,e(B inspect e$B$5$l$F$$$J$$e(B”
on Wed, 14 Oct 2009 17:38:56 +0900, Yui NARUSE
[email protected] writes:

|e$BDL>oe(B Object#inspect e$B$N7k2L$K$G$F$/$kJ8;zNs$Oe(B inspect e$B$5$l$F$$$^$9!#e(B
|e$B$7$+$7!"e(BException#inspect e$B$O$=$N$^$^$K$J$C$F$$$^$9!#e(B

|e$BC1$J$k$+$1K:$l$J5$$,$9$k$N$G$9$,$I$&$G$7$g$&!#e(B

e$BNc30$N%a%C%;!<%8$O=PNO$5$l$k$?$a$N$b$N$G$9$+$i!“e(Binspecte$B$9$ke(B
e$BI,MW$O$J$$$H$$$&H=CG$G$7$?!#@Q6KE*$Ke(Binspecte$B$7$?J}$,NI$$M}M3e(B
e$B$,$”$j$^$9$+$M!#e(B