Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove length from Stateful Iterators #142

Closed
wkearn opened this issue Jan 31, 2024 · 3 comments
Closed

Remove length from Stateful Iterators #142

wkearn opened this issue Jan 31, 2024 · 3 comments

Comments

@wkearn
Copy link
Contributor

wkearn commented Jan 31, 2024

CI is failing on nightly because of this change: JuliaLang/julia#51747

DiskArrays calls length on a Stateful iterator here:

@noinline function _iterate_disk(
a::AbstractArray{T}, i::I
) where {T,I<:Tuple{A,B,C}} where {A,B,C}
datacur::A, bi::B, bstate::C = i
(chunkiter, innerinds) = bstate
cistateold = length(chunkiter)
biter = iterate(bi, bstate)
if biter === nothing
return nothing
else
innernow, bstatenew = biter
(chunkiter, innerinds) = bstatenew
if length(chunkiter) !== cistateold
curchunk = innerinds.itr.indices
datacur = OffsetArray(a[curchunk...], innerinds.itr)
return datacur[innernow]::T, (datacur, bi, bstatenew)::I
else
return datacur[innernow]::T, (datacur, bi, bstatenew)::I
end
end
end

@rafaqz
Copy link
Collaborator

rafaqz commented Feb 1, 2024

Surely this is a breaking change to julia Base?

@rafaqz
Copy link
Collaborator

rafaqz commented Feb 1, 2024

@meggart we may need to define our own DiskStateful iterator and define length on it as in this case we know it is correct.

@felixcremer
Copy link
Contributor

This is closed by #145 .

@wkearn wkearn closed this as completed Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants