Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support python 3.12 on sagemath-standard #36407

Merged
merged 14 commits into from
Oct 21, 2023
Merged
Prev Previous commit
Next Next commit
py312: use dict instead of OrderedDict for consistent printing
In python 3.12 the printing of OrderedDict has been changed.

As of Python 3.7, regular dicts are guaranteed to be ordered, so it's
safe to replace OrderedDict by dict.

Maybe convenient to replace other uses of OrderedDict, although this is
out of scope of python 3.12 support.
  • Loading branch information
tornaria committed Oct 9, 2023
commit 3600123d07190f838cf1654573717a9b7670e651
11 changes: 5 additions & 6 deletions src/sage/monoids/trace_monoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from collections import OrderedDict
from itertools import repeat, chain, product

from sage.misc.cachefunc import cached_method
Expand Down Expand Up @@ -633,14 +632,14 @@ def _compute_dependence_stack(self, x):
sage: x = b*a*d*a*c*b
sage: M._compute_dependence_stack(x)
({a, b, c, d},
OrderedDict([(a, [False, False, True, True, False]),
(b, [True, False, False, False, True]),
(c, [True, False, False, False]),
(d, [False, False, True, False])]))
{a: [False, False, True, True, False],
b: [True, False, False, False, True],
c: [True, False, False, False],
d: [False, False, True, False]})
"""
independence = self._independence
generators_set = set(e for e, _ in x)
stacks = OrderedDict(sorted((g, []) for g in generators_set))
stacks = dict(sorted((g, []) for g in generators_set))
for generator, times in reversed(list(x)):
stacks[generator].extend(repeat(True, times))
for other_gen in generators_set:
Expand Down