* eval.c (eval): prepend error position in evaluating string to

"mesg" attribute string only when it's available and is a
  string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-11-16 04:34:05 +00:00
parent 5af1243076
commit 8fe88cc466
2 changed files with 12 additions and 4 deletions

View File

@ -1,3 +1,9 @@
Sun Nov 16 13:26:07 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (eval): prepend error position in evaluating string to
"mesg" attribute string only when it's available and is a
string.
Sun Nov 16 12:16:10 2003 Minero Aoki <aamine@loveruby.net> Sun Nov 16 12:16:10 2003 Minero Aoki <aamine@loveruby.net>
* lib/net/protocol.rb: logging response body. [experimental] * lib/net/protocol.rb: logging response body. [experimental]

4
eval.c
View File

@ -5582,11 +5582,13 @@ eval(self, src, scope, file, line)
if (strcmp(file, "(eval)") == 0) { if (strcmp(file, "(eval)") == 0) {
VALUE mesg, errat; VALUE mesg, errat;
mesg = rb_attr_get(ruby_errinfo, rb_intern("mesg"));
if (!NIL_P(mesg) && TYPE(mesg) == T_STRING) {
errat = get_backtrace(ruby_errinfo); errat = get_backtrace(ruby_errinfo);
mesg = rb_obj_as_string(ruby_errinfo);
rb_str_update(mesg, 0, 0, RARRAY(errat)->ptr[0]); rb_str_update(mesg, 0, 0, RARRAY(errat)->ptr[0]);
RARRAY(errat)->ptr[0] = RARRAY(backtrace(-2))->ptr[0]; RARRAY(errat)->ptr[0] = RARRAY(backtrace(-2))->ptr[0];
} }
}
rb_exc_raise(ruby_errinfo); rb_exc_raise(ruby_errinfo);
} }
JUMP_TAG(state); JUMP_TAG(state);