python-compat: adapt to Python 3.11 BC breakage with `random.sample`

As per

"The population parameter of `random.sample()` must be a sequence, and
automatic conversion of sets to lists is no longer supported.
Also, if the sample size is larger than the population size,
a `ValueError` is raised"
8 jobs for topic/stable/py3.11-compat in 15 minutes and 51 seconds (queued for 2 seconds)