ruby-changes:11593
From: yugui <ko1@a...>
Date: Sun, 19 Apr 2009 22:35:45 +0900 (JST)
Subject: [ruby-changes:11593] Ruby:r23230 (ruby_1_9_1): merges r23097 from trunk into ruby_1_9_1.
yugui 2009-04-19 22:35:19 +0900 (Sun, 19 Apr 2009) New Revision: 23230 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23230 Log: merges r23097 from trunk into ruby_1_9_1. -- * vm_eval.c (eval_string_with_cref): replaces the message if frozen. [ruby-dev:38208] Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/vm_eval.c Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 23229) +++ ruby_1_9_1/ChangeLog (revision 23230) @@ -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] + Sun Mar 29 08:59:26 2009 Nobuyoshi Nakada <nobu@r...> * lib/pathname.rb (Pathname#relative_path_from): compares path Index: ruby_1_9_1/vm_eval.c =================================================================== --- ruby_1_9_1/vm_eval.c (revision 23229) +++ ruby_1_9_1/vm_eval.c (revision 23230) @@ -772,14 +772,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/