ruby-changes:11472
From: nobu <ko1@a...>
Date: Mon, 30 Mar 2009 12:13:16 +0900 (JST)
Subject: [ruby-changes:11472] Ruby:r23097 (trunk): * vm_eval.c (eval_string_with_cref): replaces the message if
nobu 2009-03-30 12:12:48 +0900 (Mon, 30 Mar 2009) New Revision: 23097 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23097 Log: * vm_eval.c (eval_string_with_cref): replaces the message if frozen. [ruby-dev:38208] Modified files: trunk/ChangeLog trunk/vm_eval.c Index: ChangeLog =================================================================== --- ChangeLog (revision 23096) +++ ChangeLog (revision 23097) @@ -1,3 +1,8 @@ +Mon Mar 30 12:12:46 2009 Nobuyoshi Nakada <nobu@r...> + + * vm_eval.c (eval_string_with_cref): replaces the message if + frozen. [ruby-dev:38208] + Mon Mar 30 01:00:20 2009 James Edward Gray II <jeg2@r...> * test/csv/test_interface.rb: Trying a fix for some failing tests Index: vm_eval.c =================================================================== --- vm_eval.c (revision 23096) +++ vm_eval.c (revision 23097) @@ -773,14 +773,22 @@ if (strcmp(file, "(eval)") == 0) { VALUE mesg, errat, bt2; extern VALUE rb_get_backtrace(VALUE info); + ID id_mesg; + CONST_ID(id_mesg, "mesg"); errat = rb_get_backtrace(errinfo); - mesg = rb_attr_get(errinfo, rb_intern("mesg")); + mesg = rb_attr_get(errinfo, id_mesg); if (!NIL_P(errat) && TYPE(errat) == T_ARRAY && (bt2 = vm_backtrace(th, -2), RARRAY_LEN(bt2) > 0)) { if (!NIL_P(mesg) && TYPE(mesg) == T_STRING && !RSTRING_LEN(mesg)) { - rb_str_update(mesg, 0, 0, rb_str_new2(": ")); - rb_str_update(mesg, 0, 0, RARRAY_PTR(errat)[0]); + if (OBJ_FROZEN(mesg)) { + VALUE m = rb_str_cat(rb_str_dup(RARRAY_PTR(errat)[0]), ": ", 2); + rb_ivar_set(errinfo, id_mesg, rb_str_append(m, mesg)); + } + else { + rb_str_update(mesg, 0, 0, rb_str_new2(": ")); + rb_str_update(mesg, 0, 0, RARRAY_PTR(errat)[0]); + } } RARRAY_PTR(errat)[0] = RARRAY_PTR(bt2)[0]; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/