Backport #6000
closedrespond_to? check in check_funcall() does not work with single-argument respond_to?
Description
=begin
The following code works in Ruby 1.9.3:
class C
def respond_to? name
super name
end
end
[C.new].flatten
But fails with ArgumentError after r32855:
$ ruby20 -v test.rb
ruby 2.0.0dev (2012-02-11 trunk 34547) [x86_64-darwin11.2.0]
test.rb:2:in respond_to?': wrong number of arguments (2 for 1) (ArgumentError) from test.rb:7:in
flatten'
from test.rb:7:in `'
I think this should still work to support legacy 1.9 applications in 2.0
=end
Files
Updated by drbrain (Eric Hodel) about 12 years ago
Updated by nobu (Nobuyoshi Nakada) about 12 years ago
seems fine.
Updated by drbrain (Eric Hodel) about 12 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r34564.
Eric, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- vm_eval.c (check_funcall): Call respond_to? with matching arity for
legacy single-argument implementations. [ruby-trunk - Bug #6000]
Updated by naruse (Yui NARUSE) about 12 years ago
- Tracker changed from Bug to Backport
- Project changed from Ruby master to Backport193
- Category deleted (
core) - Status changed from Closed to Open
- Target version deleted (
2.0.0)
Updated by nobu (Nobuyoshi Nakada) about 12 years ago
- Status changed from Open to Closed
This issue was solved with changeset r34616.
Eric, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
merge revision(s) r34564:
* vm_eval.c (check_funcall): Call respond_to? with matching arity for
legacy single-argument implementations. [ruby-trunk - Bug #6000]
Updated by mame (Yusuke Endoh) about 12 years ago
- Status changed from Closed to Assigned
- Assignee set to drbrain (Eric Hodel)
Hello,
Your patch causes SEGV:
class C
def respond_to? x, y, z
p z
end
end
[C.new].flatten #=> SEGV
Did you mean "arity >= 3" instead of "arity > 3" ?
(Note that I don't understand this ticket.)
Coverity Scan found this bug.
--
Yusuke Endoh mame@tsg.ne.jp
Updated by usa (Usaku NAKAMURA) about 12 years ago
- Tracker changed from Backport to Bug
- Project changed from Backport193 to Ruby master
Updated by drbrain (Eric Hodel) about 12 years ago
- ruby -v set to -
=begin
Fixed by r35025
I was depending upon vm_call0() to perform arity checking, but it does not, so r35025 does it by hand.
Existing ruby libraries have (({def respond_to? method})). Before r34564 ruby trunk called respond_to? with two arguments, the method and a boolean to include private methods, which broke backwards compatibility. This bug is about allowing respond_to? implementations from ruby 1.8 and ruby 1.9 to continue to work.
=end
Updated by drbrain (Eric Hodel) about 12 years ago
- Status changed from Assigned to Closed
I do not know how to move this ticket to the Backport tracker, can someone please backport it?
Updated by marcandre (Marc-Andre Lafortune) about 12 years ago
- Tracker changed from Bug to Backport
- Project changed from Ruby master to Backport193
Moved as backport