Backport #8884

`caller(1, nil)` raises a runtime error while its reference says its signature as `caller(start=1, length=nil)`

Added by Goro Fuji almost 2 years ago. Updated almost 2 years ago.

[ruby-core:57094]
Status:Closed
Priority:Normal
Assignee:Tomoyuki Chikanaga

Description

$ ruby -e 'caller(1, nil)'
-e:1:in caller': no implicit conversion from nil to integer (TypeError)
from -e:1:in
'

Either the behaviour or the document looks wrong; I don't know which is wrong, though.

Associated revisions

Revision 42905
Added by Shota Fukumori almost 2 years ago

  • vm_backtrace.c (vm_backtrace_to_ary): Ignore the second argument if
    it is nil. [Bug #8884]

  • test/ruby/test_backtrace.rb (test_caller_with_nil_length):
    Test for above.

Revision 42925
Added by Tomoyuki Chikanaga almost 2 years ago

merge revision(s) 42905: [Backport #8884]

* vm_backtrace.c (vm_backtrace_to_ary): Ignore the second argument if
  it is nil. [Bug #8884] 

* test/ruby/test_backtrace.rb (test_caller_with_nil_length):
  Test for above.

History

#1 Updated by Shota Fukumori almost 2 years ago

  • Status changed from Open to Assigned
  • Assignee set to Koichi Sasada

This patch fixes: https://gist.github.com/sorah/6503895

I'll commit this if doc is correct.

#2 Updated by Nobuyoshi Nakada almost 2 years ago

Seems fine.

#3 Updated by Shota Fukumori almost 2 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r42905.
Goro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • vm_backtrace.c (vm_backtrace_to_ary): Ignore the second argument if
    it is nil. [Bug #8884]

  • test/ruby/test_backtrace.rb (test_caller_with_nil_length):
    Test for above.

#4 Updated by Shota Fukumori almost 2 years ago

  • Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: UNKNOWN, 2.0.0: REQUIRED

documentation on 2.0.0 is same, so flagging as backport onto 2.0.0 needed.

#5 Updated by Tomoyuki Chikanaga almost 2 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby trunk to Backport200
  • Status changed from Closed to Assigned
  • Assignee changed from Koichi Sasada to Tomoyuki Chikanaga

On 1.9.3, Kernel#caller has only one argument.
I will move this ticket to Backport 200.

#6 Updated by Tomoyuki Chikanaga almost 2 years ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r42925.
Goro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 42905: [Backport #8884]

* vm_backtrace.c (vm_backtrace_to_ary): Ignore the second argument if
  it is nil. [Bug #8884] 

* test/ruby/test_backtrace.rb (test_caller_with_nil_length):
  Test for above.

Also available in: Atom PDF