From abeedb0875f3fb8e8d1329b8dc885b159cb61841 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 19 Sep 2012 15:42:26 +0000 Subject: array.c, enum.c: TypeError in zip * array.c (take_items), enum.c (enum_zip): raise TypeError at non-enumerable objects, not NoMethodError. [ruby-dev:46145] [Bug #7038] * vm_eval.c (rb_check_block_call): check_funcall variant with block function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- array.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'array.c') diff --git a/array.c b/array.c index 8b2c4c5c8b..0e4061931f 100644 --- a/array.c +++ b/array.c @@ -2795,7 +2795,8 @@ take_items(VALUE obj, long n) if (!NIL_P(result)) return rb_ary_subseq(result, 0, n); result = rb_ary_new2(n); args[0] = result; args[1] = (VALUE)n; - rb_block_call(obj, rb_intern("each"), 0, 0, take_i, (VALUE)args); + if (rb_check_block_call(obj, rb_intern("each"), 0, 0, take_i, (VALUE)args) == Qundef) + Check_Type(obj, T_ARRAY); return result; } -- cgit v1.2.3