diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-23 08:39:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-23 08:39:55 +0000 |
commit | 04c9bdb19098678e245fa2a0d4173cc6f2d4ca59 (patch) | |
tree | dbd1a6e6ce89f61cea296bbab8bf9eb12786b503 /vm_eval.c | |
parent | 1a56e716b1c555e7ab717e3f8ab3a552391065a2 (diff) |
vm_eval.c: preserve passed_block
* vm_eval.c (check_funcall_respond_to): preserve passed_block, which
is modified in vm_call0_body() via vm_call0(), and caused a bug of
rb_check_funcall() by false negative result of rb_block_given_p().
re-fix [ruby-core:53650] [Bug #8153].
[ruby-core:53653] [Bug #8154]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r-- | vm_eval.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -358,7 +358,8 @@ check_funcall_respond_to(rb_thread_t *th, VALUE klass, VALUE recv, ID mid) const rb_method_entry_t *me = rb_method_entry(klass, idRespond_to, &defined_class); if (me && !(me->flag & NOEX_BASIC)) { - VALUE args[2]; + const rb_block_t *passed_block = th->passed_block; + VALUE args[2], result; int arity = rb_method_entry_arity(me); if (arity > 2) @@ -368,7 +369,9 @@ check_funcall_respond_to(rb_thread_t *th, VALUE klass, VALUE recv, ID mid) args[0] = ID2SYM(mid); args[1] = Qtrue; - if (!RTEST(vm_call0(th, recv, idRespond_to, arity, args, me, defined_class))) { + result = vm_call0(th, recv, idRespond_to, arity, args, me, defined_class); + th->passed_block = passed_block; + if (!RTEST(result)) { return FALSE; } } |