mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) fd8991f797: [Backport #17889]
Fix lazy enumerator with index size Fixes [Bug #17889] --- enumerator.c | 7 ++++++- test/ruby/test_lazy_enumerator.rb | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-)
This commit is contained in:
parent
9d63a8dd0b
commit
20bf397f7c
3 changed files with 11 additions and 2 deletions
|
|
@ -2678,8 +2678,13 @@ lazy_with_index_proc(VALUE proc_entry, struct MEMO* result, VALUE memos, long me
|
|||
return result;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
lazy_with_index_size(VALUE proc, VALUE receiver) {
|
||||
return receiver;
|
||||
}
|
||||
|
||||
static const lazyenum_funcs lazy_with_index_funcs = {
|
||||
lazy_with_index_proc, 0,
|
||||
lazy_with_index_proc, lazy_with_index_size,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -682,4 +682,8 @@ EOS
|
|||
ary = (0..Float::INFINITY).lazy.with_index.take(2).to_a
|
||||
assert_equal([[0, 0], [1, 1]], ary)
|
||||
end
|
||||
|
||||
def test_with_index_size
|
||||
assert_equal(3, Enumerator::Lazy.new([1, 2, 3], 3){|y, v| y << v}.with_index.size)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
||||
#define RUBY_VERSION_TEENY 2
|
||||
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
||||
#define RUBY_PATCHLEVEL 89
|
||||
#define RUBY_PATCHLEVEL 90
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2021
|
||||
#define RUBY_RELEASE_MONTH 5
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue