You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A model using Set[Enum] hangs when the collection length exceeds the size of the enum.
The example below is intended to be reproducible, I think you'd run into it more typically in practice with a randomized collection length and a (default) max collection length that's larger than the size of the set.
As you have identified, this only happens when a set is used with enums and if the expected length of this set is higher than the enum members (it will never find find elements to satisfy this, so it keeps looping). What can be the expected behavior here?
If __min_collection_length__ > len(finite_members) and if "container is a type that guarantees uniqueness and the possible elements themselves are finite", I can think of two ways.
Throw an exception
Return all the elements of the enum in the resulting set (I can see this as a similar behavior to python sets {1, 1, 1} does not error out, it is the same as {1})
With the combination of the default max collection length (that you can't differentiate from a user-specified value?) and the fact that it seems difficult to set max length values for individual fields, I would think all enum values (+ potentially a warning, but the library doesn't seem to use warnings much) is better than an exception?
Description
A model using
Set[Enum]
hangs when the collection length exceeds the size of the enum.The example below is intended to be reproducible, I think you'd run into it more typically in practice with a randomized collection length and a (default) max collection length that's larger than the size of the set.
URL to code causing the issue
No response
MCVE
Steps to reproduce
No response
Screenshots
No response
Logs
No response
Release Version
2.16.2
Platform
Note
While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.
Check out all issues funded or available for funding on our Polar.sh dashboard
The text was updated successfully, but these errors were encountered: