Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
| def iter_choices(self) -> Iterator[_FullChoice]: ... | ||
| def _iter_choices_normalized(self) -> Iterator[Choice]: ... | ||
| def has_groups(self) -> bool: ... | ||
| def iter_groups(self) -> Iterator[_FullGroupedChoices]: ... | ||
| def _iter_groups_normalized(self) -> Iterator[tuple[str, list[Choice]]]: ... |
There was a problem hiding this comment.
I'm a little conflicted about exposing these internal normalization helpers, that are likely to disappear in 3.4.0
Yielding a plain tuple is deprecated and the Select widget will check for that and emit a DeprecationWarning, but during this deprecation period there's no guarantees about whether or not you will get a plain tuple, or the Choice named tuple if you're using custom subclasses that haven't been updated yet.
So either we change iter_choices and iter_groups to the new signatures and you get a hard type error for something that's supposed to be just a deprecation warning and a false negative on widgets that expect to get Choice objects, when in fact they still could receive plain tuples, or we leave it like this and you cannot update your own Widgets to rely on the presence of the named Choice attributes, without exposing this internal helper, or doing the conversion yourself.
Release: https://pypi.org/pypi/WTForms/3.3.0
Repository: https://github.com/pallets-eco/wtforms
Typeshed stubs: https://github.com/python/typeshed/tree/main/stubs/WTForms
Changelog: https://wtforms.readthedocs.io/changes
Diff: pallets-eco/wtforms@3.2.2...3.3.0
Fixes: #16605
Most of the major changes are related to how choices are passed to select fields, the old style has been deprecated and will be removed in 3.4.0, this makes the types a little unwieldy now, but they should simplify again later.