diff --git a/src/sage/ext/memory.pyx b/src/sage/ext/memory.pyx index 1de6dedab82..b95130b19dd 100644 --- a/src/sage/ext/memory.pyx +++ b/src/sage/ext/memory.pyx @@ -3,14 +3,14 @@ Low-level memory allocation functions TESTS: -Check that a ``MemoryError`` is raised if we try to allocate a +Check that an error is raised if we try to allocate a ridiculously large integer, see :trac:`15363`:: - sage: 2^(2^63-3) - Traceback (most recent call last): - ... - OverflowError: exponent must be at most 2147483647 # 32-bit - RuntimeError: Aborted # 64-bit + sage: try: + ....: 2^(2^63-3) + ....: except (OverflowError, RuntimeError, FloatingPointError): + ....: print ('Overflow error') + ...Overflow error AUTHORS: diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index 2cd080ddafa..090ab59cb28 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -6654,7 +6654,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): sage: try: ....: print('Possible error output from gmp', flush=True) ....: 1 << (2^60) - ....: except (MemoryError, OverflowError, RuntimeError): + ....: except (MemoryError, OverflowError, RuntimeError, FloatingPointError): ....: pass ....: else: ....: print("Failed to raise exception")