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

Add isdone(itr::ReadEachIterator, state...) #39662

Merged
merged 1 commit into from
Feb 15, 2021

Conversation

cmcaine
Copy link
Contributor

@cmcaine cmcaine commented Feb 14, 2021

This prevents isempty and friends from advancing the iterator when they shouldn't.

Note: collect(readeach(io, T)) can throw an exception if io isn't a multiple of the right size. isempty will still return false, even if the next call to iterate will throw an exception.

Similar to: #27412

This prevents `isempty` and friends from advancing the iterator when
they shouldn't.

Note: `collect(readeach(io, T))` can throw an exception if `io` isn't a
multiple of the right size. `isempty` will still return `false`, even if
the next call to `iterate` will throw an exception.

Similar to: JuliaLang#27412
@cmcaine
Copy link
Contributor Author

cmcaine commented Feb 14, 2021

This is part of a (hopefully short) series of PRs that fix isempty for stateful iterators. I've already fixed eachline. If you know of others in Base or the standard libraries, please let me know :)

@Keno Keno merged commit 2e80fc8 into JuliaLang:master Feb 15, 2021
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
This prevents `isempty` and friends from advancing the iterator when
they shouldn't.

Note: `collect(readeach(io, T))` can throw an exception if `io` isn't a
multiple of the right size. `isempty` will still return `false`, even if
the next call to `iterate` will throw an exception.

Similar to: JuliaLang#27412
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this pull request May 9, 2021
This prevents `isempty` and friends from advancing the iterator when
they shouldn't.

Note: `collect(readeach(io, T))` can throw an exception if `io` isn't a
multiple of the right size. `isempty` will still return `false`, even if
the next call to `iterate` will throw an exception.

Similar to: JuliaLang#27412
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

Successfully merging this pull request may close these issues.

2 participants