mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (eval): check if backtrace is empty. [ruby-core:15040]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
45a5455d7a
commit
1c5640855f
2 changed files with 9 additions and 4 deletions
|
@ -1,3 +1,7 @@
|
|||
Tue Jan 15 03:41:42 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* eval.c (eval): check if backtrace is empty. [ruby-core:15040]
|
||||
|
||||
Tue Jan 15 01:28:47 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* common.mk: simplified dummy objects dependencies.
|
||||
|
|
9
eval.c
9
eval.c
|
@ -1757,16 +1757,17 @@ eval(VALUE self, VALUE src, VALUE scope, const char *file, int line)
|
|||
if (state == TAG_RAISE) {
|
||||
VALUE errinfo = th->errinfo;
|
||||
if (strcmp(file, "(eval)") == 0) {
|
||||
VALUE mesg, errat;
|
||||
VALUE mesg, errat, bt2;
|
||||
|
||||
errat = get_backtrace(errinfo);
|
||||
mesg = rb_attr_get(errinfo, rb_intern("mesg"));
|
||||
if (!NIL_P(errat) && TYPE(errat) == T_ARRAY) {
|
||||
if (!NIL_P(mesg) && TYPE(mesg) == T_STRING) {
|
||||
if (!NIL_P(errat) && TYPE(errat) == T_ARRAY &&
|
||||
(bt2 = backtrace(-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]);
|
||||
}
|
||||
RARRAY_PTR(errat)[0] = RARRAY_PTR(backtrace(-2))[0];
|
||||
RARRAY_PTR(errat)[0] = RARRAY_PTR(bt2)[0];
|
||||
}
|
||||
}
|
||||
rb_exc_raise(errinfo);
|
||||
|
|
Loading…
Reference in a new issue