From d88bc3815c0901bfdeaa3e4a31107c084199f614 Mon Sep 17 00:00:00 2001 From: Antonio Rojas Date: Mon, 31 Jul 2023 08:37:36 +0200 Subject: [PATCH 1/2] Fix tests with gmp 6.3 --- src/sage/ext/memory.pyx | 12 ++++++------ src/sage/rings/integer.pyx | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sage/ext/memory.pyx b/src/sage/ext/memory.pyx index 1de6dedab82..c5b16168d04 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") From 1038a63da308ca49dd8a7df9263c95cabfef2f78 Mon Sep 17 00:00:00 2001 From: Antonio Rojas Date: Sun, 27 Aug 2023 18:36:02 +0200 Subject: [PATCH 2/2] Fix test with gmp < 6.2 --- src/sage/ext/memory.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/ext/memory.pyx b/src/sage/ext/memory.pyx index c5b16168d04..b95130b19dd 100644 --- a/src/sage/ext/memory.pyx +++ b/src/sage/ext/memory.pyx @@ -10,7 +10,7 @@ ridiculously large integer, see :trac:`15363`:: ....: 2^(2^63-3) ....: except (OverflowError, RuntimeError, FloatingPointError): ....: print ('Overflow error') - Overflow error + ...Overflow error AUTHORS: