Project

General

Profile

Bug #9295

`Exception#backtrace_locations` returns `nil`

Added by Tsuyoshi Sawada over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
[ruby-core:59306]

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

Associated revisions

Revision 44411
Added by Koichi Sasada over 2 years ago

  • 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.

Revision 44411
Added by Koichi Sasada over 2 years ago

  • 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.

Revision 44411
Added by Koichi Sasada over 2 years ago

  • 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.

History

#1 Updated by Koichi Sasada over 2 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.

#2 [ruby-core:59321] Updated by Tsuyoshi Sawada over 2 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.

#3 [ruby-core:59322] Updated by Koichi Sasada over 2 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

#4 [ruby-core:60502] Updated by Usaku NAKAMURA about 2 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

Also available in: Atom PDF