mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
merge revision(s) 63417: [Backport #14756]
error.c: check redefined backtrace result * error.c (rb_get_backtrace): check the result of `backtrace` even if the method is redefined. [ruby-core:87013] [Bug #14756] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@64147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
312de7a9ca
commit
607d93b92e
3 changed files with 17 additions and 6 deletions
12
error.c
12
error.c
|
@ -969,19 +969,21 @@ VALUE
|
|||
rb_get_backtrace(VALUE exc)
|
||||
{
|
||||
ID mid = id_backtrace;
|
||||
VALUE info;
|
||||
if (rb_method_basic_definition_p(CLASS_OF(exc), id_backtrace)) {
|
||||
VALUE info, klass = rb_eException;
|
||||
VALUE klass = rb_eException;
|
||||
rb_thread_t *th = GET_THREAD();
|
||||
if (NIL_P(exc))
|
||||
return Qnil;
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, exc, mid, mid, klass, Qundef);
|
||||
info = exc_backtrace(exc);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, exc, mid, mid, klass, info);
|
||||
if (NIL_P(info))
|
||||
return Qnil;
|
||||
return rb_check_backtrace(info);
|
||||
}
|
||||
return rb_funcall(exc, mid, 0, 0);
|
||||
else {
|
||||
info = rb_funcallv(exc, mid, 0, 0);
|
||||
}
|
||||
if (NIL_P(info)) return Qnil;
|
||||
return rb_check_backtrace(info);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1066,5 +1066,14 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
|||
raise RuntimeError, "hello"
|
||||
}
|
||||
end;
|
||||
|
||||
error_class = Class.new(StandardError) do
|
||||
def backtrace; :backtrace; end
|
||||
end
|
||||
begin
|
||||
raise error_class
|
||||
rescue error_class => e
|
||||
assert_raise(TypeError) {$@}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define RUBY_VERSION "2.4.5"
|
||||
#define RUBY_RELEASE_DATE "2018-07-31"
|
||||
#define RUBY_PATCHLEVEL 312
|
||||
#define RUBY_PATCHLEVEL 313
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2018
|
||||
#define RUBY_RELEASE_MONTH 7
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue