leif wrote:
> Francois Bissey wrote:
>> The failing doctests are
>> sage -t --long
>> /usr/lib64/python2.7/site-packages/sage/rings/integer.pyx  # 1 doctest
>> failed
>> sage -t --long /usr/lib64/python2.7/site-packages/sage/ext/memory.pyx
>>  # 1 doctest failed
>> gmp and mpir report errors differently. There is not much we can do
>> for these two but they
>> are not about mathematical output.
> 
> Hmmm, I *think* we can mark them '# optional -- mpir' (and add modified
> copies with '# optional -- gmp').

Yep, for example the following works:


diff --git a/src/sage/ext/memory.pyx b/src/sage/ext/memory.pyx
index fe8278f..a6114eb 100644
--- a/src/sage/ext/memory.pyx
+++ b/src/sage/ext/memory.pyx
@@ -6,11 +6,16 @@ TESTS:
 Check that a ``MemoryError`` is raised if we try to allocate a
 ridiculously large integer, see :trac:`15363`::

-    sage: 2^(2^63-2)
+    sage: 2^(2^63-2) # optional -- mpir
     Traceback (most recent call last):
     ...
     RuntimeError: exponent must be at most 2147483647          # 32-bit
     MemoryError: failed to allocate 1152921504606847008 bytes  # 64-bit
+    sage: 2^(2^63-2) # optional -- gmp # not tested
+    gmp: overflow in mpz type
+    Traceback (most recent call last):
+    ...
+    RuntimeError: Aborted

 AUTHORS:

diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx
index 53f4da4..0d5e701 100644
--- a/src/sage/rings/integer.pyx
+++ b/src/sage/rings/integer.pyx
@@ -6043,11 +6043,16 @@ cdef class
Integer(sage.structure.element.EuclideanDomainElement):

         TESTS::

-            sage: 1 << (2^60)
+            sage: 1 << (2^60) # optional -- mpir
             Traceback (most recent call last):
             ...
             MemoryError: failed to allocate ... bytes   # 64-bit
             OverflowError: ...                          # 32-bit
+            sage: 1 << (2^60) # optional -- gmp # not tested
+            gmp: overflow in mpz type
+            Traceback (most recent call last):
+            ...
+            RuntimeError: Aborted
         """
         cdef long n


(The '# not tested' in addition is necessary because of the abort() /
RunTimeError.  Not sure whether we could catch that on the Cython level,
but AFAIK GMP intentionally bails out on such errors; there's no way to
resume from them as is.)


-leif


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to