Project

General

Profile

Backport #146

Updated by jeremyevans0 (Jeremy Evans) 6 months ago

=begin

The second frame's line number appears to always be incorrect when a Proc is created via a non-toplevel method call.
This small program and its output illustrate the issue:

def first # line 1 of proc_caller.rb on my system
second
end

def second
b = third do
1 + 1
end
return b
end

def third(&b)
return b
end

eval("p caller(0)", first)

Output on recent 1.8 releases, including 1.8.6 and 1.8.7:
["proc_caller.rb:6:in `second'", "proc_caller.rb:6:in `first'", "proc_caller.rb:16"]

Output that I would expect: (line 6 is in 'second', not 'first')
["proc_caller.rb:6:in `second'", "proc_caller.rb:2:in `first'", "proc_caller.rb:16"]

=end

Back