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

restrict containers accepted by multi #2995

Merged
merged 1 commit into from
Nov 6, 2024
Merged

restrict containers accepted by multi #2995

merged 1 commit into from
Nov 6, 2024

Conversation

davidism
Copy link
Member

@davidism davidism commented Nov 6, 2024

When inlining the type annotations, I noticed that iter_multi_items and related methods were annotated to accept collections.abc.Iterable, but actually called isinstance(value, (list, tuple). I expanded this to isinstance(value, Container) and not isinstance(value, str). However, this incorrectly matched and iterated over bytes, bytearray, memoryview, array, etc, all of which should be treated as single values. Rather than trying to build up an allow list, I've gone back to restricting to (list, tuple, set), adding set since it was the one built-in collection type missing that would make sense to use.

fixes #2994

@davidism davidism added this to the 3.1.3 milestone Nov 6, 2024
@davidism davidism merged commit ea93b54 into stable Nov 6, 2024
11 checks passed
@davidism davidism deleted the multi-bytes branch November 6, 2024 19:56
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant