Fix function supports_feature to return False when target_versions is empty. [skip news]#4726
Conversation
|
Can you expand on a use case where this bites a user? Do we actually end up passing an empty list to |
No, this doesn't affect functionality in any way.
The misleading behavior of this function ended up wasting quite a bit of my time while working on #4720, so I figured it’s worth fixing to save others the trouble down the line. |
|
If the function is never called with an empty value, and is never intended to be called with an empty value, let's throw a meaningful error instead of returning P.S. The CI failure does seem unrelated. |
…` is empty. [skip news] (psf#4726) * Fix function `supports_feature` to return False when `target_versions` is empty. * supports_feature: raise ValueError if target_versions is empty
…xcept*` without `as`. (#4720) * Remove parentheses around multiple exception types in `except` and `except*` when not using the `as` clause. (#4678) * Add Changelog Entry * Add Unparenthesized Except Tuple Detection. * Add tests for `except*`. * Oops! Wrong Version. * Fix function `supports_feature` to return False when `target_versions` is empty. [skip news] (#4726) * Fix function `supports_feature` to return False when `target_versions` is empty. * supports_feature: raise ValueError if target_versions is empty * Simplify conditional logic for removing except type parens.
Description
Here when
target_versionsis empty, expression gets reduced toall([])which evaluates toTruewhich is not the correct behaviour.Checklist - did you ...
--previewstyle, following thestability policy?
CHANGES.mdif necessary?