public
Last active

  • Download Gist
a.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
diff --git a/ChangeLog b/ChangeLog
index fb54b94..707c638 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Tue Sep 10 10:39:24 2013 Shota Fukumori <her@sorah.jp>
+
+ * 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 10:08:00 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
* NEWS: Update RubyGems note.
diff --git a/test/ruby/test_backtrace.rb b/test/ruby/test_backtrace.rb
index 6ab9032..91dec4a 100644
--- a/test/ruby/test_backtrace.rb
+++ b/test/ruby/test_backtrace.rb
@@ -85,6 +85,10 @@ class TestBacktrace < Test::Unit::TestCase
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
diff --git a/vm_backtrace.c b/vm_backtrace.c
index 3287c1f..3945993 100644
--- a/vm_backtrace.c
+++ b/vm_backtrace.c
@@ -787,6 +787,8 @@ vm_backtrace_to_ary(rb_thread_t *th, int argc, VALUE *argv, int lev_default, int
rb_scan_args(argc, argv, "02", &level, &vn);
+ if (argc == 2 && NIL_P(vn)) argc--;
+
switch (argc) {
case 0:
lev = lev_default + lev_plus;

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.