Project

General

Profile

Actions

Bug #17889

closed

Enumerator::Lazy#with_index should return size

Added by bjfish (Brandon Fish) over 3 years ago. Updated over 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:104058]

Description

The following example shows #size returns nil when the size was provided to new as 3.

Example

p Enumerator::Lazy.new([1, 2, 3], 3){|y, v| y << v}.with_index.size

Expected Result

3

Actual Result

nil

Updated by jeremyevans0 (Jeremy Evans) over 3 years ago

  • Backport changed from 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN to 2.6: DONTNEED, 2.7: REQUIRED, 3.0: REQUIRED

I didn't bisect, but this is probably related to 85e43e1dfecef69b935c48c235cc20f21bd4f0d4, as it affects 2.7 and 3.0 but not 2.6. I'll see if there is a way to fix this.

Updated by jeremyevans0 (Jeremy Evans) over 3 years ago

This turned out to be fairly simple to fix: https://github.com/ruby/ruby/pull/4534

Actions #3

Updated by jeremyevans (Jeremy Evans) over 3 years ago

  • Status changed from Open to Closed

Applied in changeset git|fd8991f797c145615820b4c76e6b7ac5a71339ea.


Fix lazy enumerator with index size

Fixes [Bug #17889]

Updated by nagachika (Tomoyuki Chikanaga) over 3 years ago

  • Backport changed from 2.6: DONTNEED, 2.7: REQUIRED, 3.0: REQUIRED to 2.6: DONTNEED, 2.7: REQUIRED, 3.0: DONE

ruby_3_0 20bf397f7cebd8156d76941dd54659cf9b8c8fe7 merged revision(s) fd8991f797c145615820b4c76e6b7ac5a71339ea.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0