diff --git a/ChangeLog b/ChangeLog index 78a8851329..16fb98f64e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Oct 28 13:17:17 2013 Or Cohen + + * error.c (name_err_to_s): remove no longer needed overriding, since + r30455 which made exc_to_s almost same. Fixes [GH-413]. + Mon Oct 28 12:42:11 2013 Tanaka Akira * common.mk, ext/objspace/depend, ext/coverage/depend, diff --git a/error.c b/error.c index c8d51c101d..ba9c720821 100644 --- a/error.c +++ b/error.c @@ -641,11 +641,9 @@ 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)); - r = rb_String(mesg); - return r; + return rb_String(mesg); } /* @@ -991,24 +989,6 @@ name_err_name(VALUE self) return rb_attr_get(self, rb_intern("name")); } -/* - * call-seq: - * name_error.to_s -> string - * - * Produce a nicely-formatted string representing the +NameError+. - */ - -static VALUE -name_err_to_s(VALUE exc) -{ - VALUE mesg = rb_attr_get(exc, rb_intern("mesg")); - VALUE str = mesg; - - if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc)); - StringValue(str); - return str; -} - /* * call-seq: * NoMethodError.new(msg, name [, args]) -> no_method_error @@ -1790,7 +1770,6 @@ Init_Exception(void) rb_eNameError = rb_define_class("NameError", rb_eStandardError); rb_define_method(rb_eNameError, "initialize", name_err_initialize, -1); rb_define_method(rb_eNameError, "name", name_err_name, 0); - rb_define_method(rb_eNameError, "to_s", name_err_to_s, 0); rb_cNameErrorMesg = rb_define_class_under(rb_eNameError, "message", rb_cData); rb_define_singleton_method(rb_cNameErrorMesg, "!", rb_name_err_mesg_new, NAME_ERR_MESG_COUNT); rb_define_method(rb_cNameErrorMesg, "==", name_err_mesg_equal, 1);