merge revision(s) 56766,56767: [Backport #12925]

error.c: rb_get_backtrace

	* error.c (rb_get_backtrace): move from eval_error.c to call
  exc_backtrace directly.  [ruby-core:78097] [Bug #12925]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@56786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2016-11-14 18:37:39 +00:00
parent 777cead59a
commit 6140b39558
5 changed files with 92 additions and 29 deletions

View file

@ -40,23 +40,6 @@ error_pos(void)
}
}
static VALUE
get_backtrace(VALUE info)
{
if (NIL_P(info))
return Qnil;
info = rb_funcall(info, rb_intern("backtrace"), 0);
if (NIL_P(info))
return Qnil;
return rb_check_backtrace(info);
}
VALUE
rb_get_backtrace(VALUE info)
{
return get_backtrace(info);
}
VALUE rb_exc_set_backtrace(VALUE exc, VALUE bt);
static void
@ -73,7 +56,7 @@ set_backtrace(VALUE info, VALUE bt)
bt = rb_backtrace_to_str_ary(bt);
}
}
rb_funcall(info, rb_intern("set_backtrace"), 1, bt);
rb_check_funcall(info, set_backtrace, 1, &bt);
}
static void
@ -93,7 +76,7 @@ error_print(void)
TH_PUSH_TAG(th);
if (TH_EXEC_TAG() == 0) {
errat = get_backtrace(errinfo);
errat = rb_get_backtrace(errinfo);
}
else if (errat == Qundef) {
errat = Qnil;