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

Fix incorrect computation of return_type of itr #287

Merged
merged 2 commits into from
Dec 6, 2023

Conversation

vtjnash
Copy link
Contributor

@vtjnash vtjnash commented Dec 4, 2023

The itr return type was assumed to be always the same as the first element. This is false for many objects, such as Tuple. Additionally, it was using a private API (Core.Compiler and
Core.Compiler.return_type) which are not stable across versions of Julia and may return weird and unpredictable answers. Switch to using the API in Base for this.

The `itr` return type was assumed to be always the same as the first
element. This is false for many objects, such as Tuple. Additionally,
it was using a private API (Core.Compiler and
Core.Compiler.return_type) which are not stable across versions of
Julia and may return weird and unpredictable answers. Switch to using
the API in Base for this.
@piever
Copy link
Collaborator

piever commented Dec 6, 2023

Thanks for the PR!

The itr return type was assumed to be always the same as the first element.

That part should be fine as we only really use that for empty iterables: the ::Nothing in the signature is the result of iterate(itr). Still it's true that we shouldn't rely on Base internals here.

@piever piever merged commit 15b044b into JuliaArrays:master Dec 6, 2023
6 of 7 checks passed
@vtjnash vtjnash deleted the patch-1 branch December 6, 2023 15:05
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