WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

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.

2 participants