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

Allow iterator adaptors to be used as standalone functions #404

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

irh
Copy link
Contributor

@irh irh commented Jan 8, 2025

Backport of e2bf2b5 for 0.15.1.

See #401.

Backport of e2bf2b5

The instance checks in the `iterator` module use `KValue::is_iterable`
to decide whether or not to accept the instance provided to the call.

When used as standalone functions, adaptors like
`iterator.enumerate(1..10)` were accepting the `iterator` module causing
an error to be thrown.

The fix is to extend the `is_iterable` logic to only accept object-like
maps if they implement `@iterator` or `@next`.
@irh irh merged commit 117ab52 into v0.15-fixes Jan 8, 2025
8 checks passed
@irh irh deleted the backport-iterator-standalone-function-fix branch January 8, 2025 14:01
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.

1 participant