summaryrefslogtreecommitdiff
path: root/enumerator.c
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-24 07:50:33 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-24 07:50:33 +0000
commitaab2f788d784ef73dd088f7cc6e258672da0ae59 (patch)
treeec88f460bf49be33656ac573be0024aec1d3b039 /enumerator.c
parent1af390b1ea11acd00558e8d86d23d17d328e580d (diff)
* enumerator.c (lazy_zip): raise error for bad arguments
[Bug #7706] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enumerator.c')
-rw-r--r--enumerator.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/enumerator.c b/enumerator.c
index 62dbf57070..71f473a854 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -1663,6 +1663,12 @@ lazy_zip(int argc, VALUE *argv, VALUE obj)
for (i = 0; i < argc; i++) {
v = rb_check_array_type(argv[i]);
if (NIL_P(v)) {
+ for (; i < argc; i++) {
+ if (!rb_respond_to(argv[i], id_each)) {
+ rb_raise(rb_eTypeError, "wrong argument type %s (must respond to :each)",
+ rb_obj_classname(argv[i]));
+ }
+ }
ary = rb_ary_new4(argc, argv);
func = lazy_zip_func;
break;