diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-15 01:33:56 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-15 01:33:56 +0000 |
commit | e56eea5e37a43879465d2d1d99e0e0dc89ae8684 (patch) | |
tree | 5c266542d1a0b5c73b505e8a29b5da4d485be89a /vm_eval.c | |
parent | afcd5562ae7a61479b128845360151adc3c5397c (diff) |
merge revision(s) r34564:
* vm_eval.c (check_funcall): Call respond_to? with matching arity for
legacy single-argument implementations. [ruby-trunk - Bug #6000]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r-- | vm_eval.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -274,10 +274,13 @@ check_funcall(VALUE recv, ID mid, int argc, VALUE *argv) me = rb_method_entry(klass, idRespond_to); if (me && !(me->flag & NOEX_BASIC)) { VALUE args[2]; + int arity = rb_method_entry_arity(me); + + if (arity < 1 || arity > 3) arity = 2; args[0] = ID2SYM(mid); args[1] = Qtrue; - if (!RTEST(vm_call0(th, recv, idRespond_to, 2, args, me))) { + if (!RTEST(vm_call0(th, recv, idRespond_to, arity, args, me))) { return Qundef; } } |