This project is closed and read-only.
Actions
Backport #146
closedIncorrect line numbers in "caller" output when evaluated in a Proc binding
Backport #146:
Incorrect line numbers in "caller" output when evaluated in a Proc binding
Status:
Closed
Assignee:
Description
=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
Actions