Fix #887: pass a list to random.sample() #888
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using a set in a call to the
sample(…)
method from the Pythonrandom
standard library has been deprecated since Python 3.9, and in Python 3.11, it causes an error. This was happening in the functionutil.py:_apply_random_control(…)
starting on line 111. Changing the set to a list in the call is probably the most efficient way of addressing this compatibility problem, and is backward-compatible with Python versions prior to 3.11.I searched but could not find another place where a set was being passed to
sample()
. (There are other calls torandom.sample()
, but none involve sets, as far as I have been able to determine.)