diff --git a/ChangeLog b/ChangeLog index 6033fe9e48..1c35787ac9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Aug 28 20:22:49 2008 Yukihiro Matsumoto + + * vm_insnhelper.c (vm_yield_setup_args): object with to_ary should + behave like array. a patch from Yusuke Endoh + in [ruby-dev:35988]. [ruby-dev:35977] + Thu Aug 28 19:04:50 2008 NAKAMURA Usaku * bootstraptest/test_io.rb: no need to create real file. diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 07fe32d2a2..f40d6a2414 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -704,6 +704,7 @@ vm_yield_setup_args(rb_thread_t * const th, const rb_iseq_t *iseq, int i; int argc = orig_argc; const int m = iseq->argc; + VALUE ary; th->mark_stack_len = argc; @@ -714,8 +715,7 @@ vm_yield_setup_args(rb_thread_t * const th, const rb_iseq_t *iseq, */ if (!(iseq->arg_simple & 0x02) && (m + iseq->arg_post_len) > 0 && - argc == 1 && TYPE(argv[0]) == T_ARRAY) { - VALUE ary = argv[0]; + argc == 1 && !NIL_P(ary = rb_check_array_type(argv[0]))) { th->mark_stack_len = argc = RARRAY_LEN(ary); CHECK_STACK_OVERFLOW(th->cfp, argc);