Stopgaps

exception sage.misc.stopgap.StopgapWarning

Bases: Warning

This class is used to warn users of a known issue that may produce mathematically incorrect results.

sage.misc.stopgap.set_state(mode)

Enable or disable the stopgap warnings.

INPUT:

  • mode – (bool); if True, enable stopgaps; otherwise, disable.

EXAMPLES:

sage: import sage.misc.stopgap
sage: sage.misc.stopgap.set_state(False)
sage: sage.misc.stopgap.stopgap("Displays nothing.", 12345)
sage: sage.misc.stopgap.set_state(True)
sage: sage.misc.stopgap.stopgap("Displays something.", 123456)
doctest:...:
...StopgapWarning: Displays something.
This issue is being tracked at https://trac.sagemath.org/sage_trac/ticket/123456.
sage: sage.misc.stopgap.set_state(False)
sage.misc.stopgap.stopgap(message, ticket_no)

Issue a stopgap warning.

INPUT:

  • message - an explanation of how an incorrect answer might be produced.

  • ticket_no - an integer, giving the number of the Trac ticket tracking the underlying issue.

EXAMPLES:

sage: import sage.misc.stopgap
sage: sage.misc.stopgap.set_state(True)
sage: sage.misc.stopgap.stopgap("Computation of heights on elliptic curves over number fields can return very imprecise results.", 12509)
doctest:...
...StopgapWarning: Computation of heights on elliptic curves over number fields can return very imprecise results.
This issue is being tracked at https://trac.sagemath.org/sage_trac/ticket/12509.
sage: sage.misc.stopgap.stopgap("This is not printed", 12509)
sage: sage.misc.stopgap.set_state(False)  # so rest of doctesting fine