# HG changeset patch # User Raphaël Gomès # Date 1668875290 -3600 # Node ID 29fb13dcb56ce1614743089175eed8c9cda6359c # Parent 2cfae49c6c3440ecf1057dbbec265d2dd38adc06 python-compat: adapt to Python 3.11 BC breakage with `random.sample` As per https://docs.python.org/3/whatsnew/3.11.html#porting-to-python-3-11: "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" diff -r 2cfae49c6c34 -r 29fb13dcb56c hgext3rd/evolve/stablerangecache.py --- a/hgext3rd/evolve/stablerangecache.py Wed Oct 26 19:44:03 2022 +0400 +++ b/hgext3rd/evolve/stablerangecache.py Sat Nov 19 17:28:10 2022 +0100 @@ -200,7 +200,7 @@ if len(new) < 300: sample = new else: - sample = random.sample(new, 300) + sample = random.sample(list(new), 300) known.update(sample) query = _make_querysuperranges(sample) ranges = set(con.execute(query).fetchall())