Skip to content

Commit

Permalink
src/sage/groups/libgap_mixin.py: hide info warning for isomorphism ch…
Browse files Browse the repository at this point in the history
…ecks

GAP emits an "InfoWarning" message when it is checking for isomorphism
between two groups that are not known to be finite. This message is
only shown once, however, because after it checks for finiteness, it
knows. We have to keep this in mind during tests. For example,

  File "src/sage/groups/finitely_presented_named.py", line 485, in
  sage.groups.finitely_presented_named.AlternatingPresentation
  Failed example:
      A1.is_isomorphic(A2), A1.order()
  Expected:
      (True, 1)
  Got:
      #I  Forcing finiteness test
      (True, 1)

These warnings are "normal" and there's nothing for the user to do.
This commit hides them for the duration of the isomorphism check.

Fixes sagemath#38889
  • Loading branch information
orlitzky committed Nov 12, 2024
1 parent 209ae4c commit 704ed9f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/sage/groups/libgap_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,4 +946,16 @@ def is_isomorphic(self, H):
sage: F == G, G == H, F == H
(False, False, False)
"""
return self.gap().IsomorphismGroups(H.gap()) != libgap.fail
# If GAP doesn't know that the groups are finite, it will
# check. This emits an informational warning, and then
# annotates the groups as being finite (assuming they were) so
# that future isomorphism checks are silent. This can lead to
# apparent non-determinism in the output as statements are
# rearranged. There's nothing the user can do about this
# anyway, and it happens in trivial cases like the alternating
# group on one element, so we prefer to hide the warning.
old_warnlevel = libgap.InfoLevel(libgap.InfoWarning)
libgap.SetInfoLevel(libgap.InfoWarning, 0)
result = self.gap().IsomorphismGroups(H.gap()) != libgap.fail
libgap.SetInfoLevel(libgap.InfoWarning, old_warnlevel)
return result

0 comments on commit 704ed9f

Please sign in to comment.