diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-22 11:23:56 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-22 11:23:56 +0000 |
commit | 8717f0787df49080d742c366bb8e70c7527ef6bd (patch) | |
tree | 6e7b84ed7b531adfab25916bb6762b1e79b5ec42 /enumerator.c | |
parent | d96483de720f6a54292b15fea2458befa02a3ffa (diff) |
Set the size of a new enumerator created by Enumerator#each with arguments to nil
When each() takes arguments, it is never safe to assume that the iteration
would repeat the same number of times as with each() without any
argument. Actually, there is no way to get the exact number, so the
size should be set to nil to denote that.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enumerator.c')
-rw-r--r-- | enumerator.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/enumerator.c b/enumerator.c index a366b75232..24444cdc53 100644 --- a/enumerator.c +++ b/enumerator.c @@ -550,6 +550,8 @@ enumerator_each(int argc, VALUE *argv, VALUE obj) args = rb_ary_new4(argc, argv); } e->args = args; + e->size = Qnil; + e->size_fn = 0; } if (!rb_block_given_p()) return obj; return enumerator_block_call(obj, 0, obj); |