Bug #9295
closed`Exception#backtrace_locations` returns `nil`
Description
=begin
If I raise an ArgumentError
by calling a method with wrong number of arguments, Exception#backtrace_locations
returns nil
, which I think is a bug:
def foo; end
begin
foo(:bar)
rescue => e
p e.backtrace_locations
end
# => nil
If, instead, I raise an error manually, then it returns an array as expected:
begin
raise ArgumentError.new
rescue => e
p e.backtrace_locations
end
# => ["this_file:2:in `<main>'"]
=end
Updated by ko1 (Koichi Sasada) over 11 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r44411.
Tsuyoshi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- vm_insnhelper.c (argument_error): insert dummy frame to make
a backtrace object intead of modify backtrace string array.
[Bug #9295] - test/ruby/test_backtrace.rb: add a test for this patch.
fix test to compare a result of Exception#backtrace with
a result of Exception#backtrace_locations.
Updated by sawa (Tsuyoshi Sawada) over 11 years ago
Thank you for the quick action, but the problem still remains in ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]. It still returns nil
.
Updated by ko1 (Koichi Sasada) over 11 years ago
(2013/12/26 13:15), sawa (Tsuyoshi Sawada) wrote:
Thank you for the quick action, but the problem still remains in ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]. It still returns
nil
.
it was pending to 2.1.1 because it is not critical.
--
// SASADA Koichi at atdot dot net
Updated by usa (Usaku NAKAMURA) over 11 years ago
- Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN to 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: UNKNOWN