diff --git a/ChangeLog b/ChangeLog index 0479596c53..ac7c91373c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Jul 19 19:40:00 2006 Yukihiro Matsumoto + + * eval.c (rb_yield_0): should check args_args before lambda + argument check. [ruby-dev:29029] + Tue Jul 18 23:53:59 2006 NAKAMURA Usaku * process.c (rb_f_system): shouldn't block SIGCHLD if it's not diff --git a/eval.c b/eval.c index aed3565c76..5c9ec1728f 100644 --- a/eval.c +++ b/eval.c @@ -4710,7 +4710,7 @@ rb_yield_0(VALUE val, VALUE self, VALUE klass /* OK */, int flags) int old_vmode; struct FRAME frame; NODE *cnode = ruby_current_node; - int ary_args = flags & YIELD_ARY_ARGS, lambda; + int ary_args, lambda; int state, broken = 0; rb_need_block(); @@ -4744,6 +4744,7 @@ rb_yield_0(VALUE val, VALUE self, VALUE klass /* OK */, int flags) node = block->body; var = block->var; lambda = block->flags & BLOCK_LAMBDA; + ary_args = flags & YIELD_ARY_ARGS; if (var) { PUSH_TAG(PROT_NONE); if ((state = EXEC_TAG()) == 0) { @@ -4819,7 +4820,7 @@ rb_yield_0(VALUE val, VALUE self, VALUE klass /* OK */, int flags) POP_TAG(); if (state) goto pop_state; } - else if (lambda && RARRAY(val)->len != 0 && + else if (lambda && ary_args && RARRAY(val)->len != 0 && (!node || nd_type(node) != NODE_IFUNC || node->nd_cfnc != bmcall)) { rb_raise(rb_eArgError, "wrong number of arguments (%ld for 0)",