ruby-changes:30826
From: sorah <ko1@a...>
Date: Tue, 10 Sep 2013 14:37:47 +0900 (JST)
Subject: [ruby-changes:30826] sorah:r42905 (trunk): * vm_backtrace.c (vm_backtrace_to_ary): Ignore the second argument if
sorah 2013-09-10 14:37:39 +0900 (Tue, 10 Sep 2013) New Revision: 42905 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42905 Log: * vm_backtrace.c (vm_backtrace_to_ary): Ignore the second argument if it is nil. [Bug #8884] [ruby-core:57094] * test/ruby/test_backtrace.rb (test_caller_with_nil_length): Test for above. Modified files: trunk/ChangeLog trunk/test/ruby/test_backtrace.rb trunk/vm_backtrace.c Index: ChangeLog =================================================================== --- ChangeLog (revision 42904) +++ ChangeLog (revision 42905) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Sep 10 14:37:01 2013 Shota Fukumori <sorah@t...> + + * vm_backtrace.c (vm_backtrace_to_ary): Ignore the second argument if + it is nil. [Bug #8884] [ruby-core:57094] + + * test/ruby/test_backtrace.rb (test_caller_with_nil_length): + Test for above. + Tue Sep 10 12:39:17 2013 Nobuyoshi Nakada <nobu@r...> * class.c (method_entry_i): should exclude refined methods from Index: vm_backtrace.c =================================================================== --- vm_backtrace.c (revision 42904) +++ vm_backtrace.c (revision 42905) @@ -787,6 +787,8 @@ vm_backtrace_to_ary(rb_thread_t *th, int https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L787 rb_scan_args(argc, argv, "02", &level, &vn); + if (argc == 2 && NIL_P(vn)) argc--; + switch (argc) { case 0: lev = lev_default + lev_plus; Index: test/ruby/test_backtrace.rb =================================================================== --- test/ruby/test_backtrace.rb (revision 42904) +++ test/ruby/test_backtrace.rb (revision 42905) @@ -85,6 +85,10 @@ class TestBacktrace < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/ruby/test_backtrace.rb#L85 rec[m] end + def test_caller_with_nil_length + assert_equal caller(0), caller(0, nil) + end + def test_caller_locations cs = caller(0); locs = caller_locations(0).map{|loc| loc.to_s -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/