Stopgaps¶
- exception sage.misc.stopgap.StopgapWarning[source]¶
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)[source]¶
Enable or disable the stopgap warnings.
INPUT:
mode
– boolean; ifTrue
, 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://github.com/sagemath/sage/issues/123456. sage: sage.misc.stopgap.set_state(False)
>>> from sage.all import * >>> import sage.misc.stopgap >>> sage.misc.stopgap.set_state(False) >>> sage.misc.stopgap.stopgap("Displays nothing.", Integer(12345)) >>> sage.misc.stopgap.set_state(True) >>> sage.misc.stopgap.stopgap("Displays something.", Integer(123456)) doctest:...: ...StopgapWarning: Displays something. This issue is being tracked at https://github.com/sagemath/sage/issues/123456. >>> sage.misc.stopgap.set_state(False)
- sage.misc.stopgap.stopgap(message, issue_no)[source]¶
Issue a stopgap warning.
INPUT:
message
– an explanation of how an incorrect answer might be producedissue_no
– integer; giving the number of the Github issue 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://github.com/sagemath/sage/issues/12509. sage: sage.misc.stopgap.stopgap("This is not printed", 12509) sage: sage.misc.stopgap.set_state(False) # so rest of doctesting fine
>>> from sage.all import * >>> import sage.misc.stopgap >>> sage.misc.stopgap.set_state(True) >>> sage.misc.stopgap.stopgap("Computation of heights on elliptic curves over number fields can return very imprecise results.", Integer(12509)) doctest:... ...StopgapWarning: Computation of heights on elliptic curves over number fields can return very imprecise results. This issue is being tracked at https://github.com/sagemath/sage/issues/12509. >>> sage.misc.stopgap.stopgap("This is not printed", Integer(12509)) >>> sage.misc.stopgap.set_state(False) # so rest of doctesting fine