1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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>
* lib/net/protocol.rb: logging response body. [experimental]

10
eval.c
View file

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