summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-12 22:05:05 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-12 22:05:05 +0000
commit36a0e432f26cc3e52706c7be983a4c5f66844d29 (patch)
tree18d2ef1d273eec128ac12e9a19d29da4c318d549
parentb404cbac7723558f42865ff78ed79aa313a72d9e (diff)
Exception#to_s should actually call to_s.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--error.c5
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ec8b0cc..68a171c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Jan 13 06:27:29 2011 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * error.c: Exception#to_s should actually call to_s.
+
Thu Jan 13 00:32:54 2011 NARUSE, Yui <naruse@ruby-lang.org>
* addr2line.c (get_nth_dirname): decrement the directory index
diff --git a/error.c b/error.c
index b58f0f7..217740f 100644
--- a/error.c
+++ b/error.c
@@ -522,9 +522,12 @@ static VALUE
exc_to_s(VALUE exc)
{
VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
+ VALUE r = Qnil;
if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
- return rb_String(mesg);
+ r = rb_String(mesg);
+ OBJ_INFECT(r, exc);
+ return r;
}
/*