зеркало из https://github.com/github/ruby.git
Added Thread::Backtrace.limit [Feature #17479]
This commit is contained in:
Родитель
522b256689
Коммит
4f47d655e3
|
@ -15613,10 +15613,12 @@ vm_backtrace.$(OBJEXT): $(hdrdir)/ruby.h
|
|||
vm_backtrace.$(OBJEXT): $(hdrdir)/ruby/ruby.h
|
||||
vm_backtrace.$(OBJEXT): $(top_srcdir)/internal/array.h
|
||||
vm_backtrace.$(OBJEXT): $(top_srcdir)/internal/compilers.h
|
||||
vm_backtrace.$(OBJEXT): $(top_srcdir)/internal/error.h
|
||||
vm_backtrace.$(OBJEXT): $(top_srcdir)/internal/gc.h
|
||||
vm_backtrace.$(OBJEXT): $(top_srcdir)/internal/imemo.h
|
||||
vm_backtrace.$(OBJEXT): $(top_srcdir)/internal/serial.h
|
||||
vm_backtrace.$(OBJEXT): $(top_srcdir)/internal/static_assert.h
|
||||
vm_backtrace.$(OBJEXT): $(top_srcdir)/internal/string.h
|
||||
vm_backtrace.$(OBJEXT): $(top_srcdir)/internal/vm.h
|
||||
vm_backtrace.$(OBJEXT): $(top_srcdir)/internal/warnings.h
|
||||
vm_backtrace.$(OBJEXT): {$(VPATH)}assert.h
|
||||
|
|
|
@ -77,6 +77,8 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||
assert_in_out_err(%w(--backtrace-limit=3), code, [],
|
||||
[/.*unhandled exception\n/, *[/^\tfrom .*\n/]*3,
|
||||
/^\t \.{3} \d+ levels\.{3}\n/])
|
||||
assert_kind_of(Integer, Thread::Backtrace.limit)
|
||||
assert_in_out_err(%w(--backtrace-limit=1), "p Thread::Backtrace.limit", ['1'], [])
|
||||
end
|
||||
|
||||
def test_warning
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "eval_intern.h"
|
||||
#include "internal.h"
|
||||
#include "internal/error.h"
|
||||
#include "internal/vm.h"
|
||||
#include "iseq.h"
|
||||
#include "ruby/debug.h"
|
||||
|
@ -839,6 +840,12 @@ backtrace_load_data(VALUE self, VALUE str)
|
|||
return self;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
backtrace_limit(VALUE self)
|
||||
{
|
||||
return LONG2NUM(rb_backtrace_length_limit);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_ec_backtrace_str_ary(const rb_execution_context_t *ec, long lev, long n)
|
||||
{
|
||||
|
@ -1201,6 +1208,7 @@ Init_vm_backtrace(void)
|
|||
rb_define_alloc_func(rb_cBacktrace, backtrace_alloc);
|
||||
rb_undef_method(CLASS_OF(rb_cBacktrace), "new");
|
||||
rb_marshal_define_compat(rb_cBacktrace, rb_cArray, backtrace_dump_data, backtrace_load_data);
|
||||
rb_define_singleton_method(rb_cBacktrace, "limit", backtrace_limit, 0);
|
||||
|
||||
/*
|
||||
* An object representation of a stack frame, initialized by
|
||||
|
|
Загрузка…
Ссылка в новой задаче