Project

General

Profile

Actions

Bug #17581

closed

Ruby 3.0 backtrace sometimes returns empty array

Added by HParker (Adam Hess) almost 4 years ago. Updated over 3 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 3.0.0dev (2020-09-04T16:41:35Z master de30450d91) [x86_64-darwin19]
[ruby-core:102242]

Description

class Foo
  def bar
    p caller(1,1)
  end
end
[Foo.new].group_by(&:bar)

3.0: []

2.7: ["test2.rb:6:in `each'"]

A similar thing happens when asking for a larger part of the backtrace:

class Foo
  def bar
    p caller(0,4)
  end
end
[Foo.new].group_by(&:bar)

3.0: ["test2.rb:3:in bar'", "test2.rb:6:in each'", "test2.rb:6:in `group_by'"]

2.7: ["test2.rb:3:in bar'", "test2.rb:6:in each'", "test2.rb:6:in group_by'", "test2.rb:6:in '"]

I suspect it was introduced by: https://github.com/ruby/ruby/commit/3b24b7914c16930bfadc89d6aff6326a51c54295
Since it seems to have to do with which frames are returned, though I haven't verified since the commit is difficult to revert.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0