#6468: FiniteField_prime_modn.__call__ should raise an error, rather than return
an error
------------------------------+---------------------------------------------
Reporter: SimonKing | Owner: somebody
Type: defect | Status: new
Priority: major | Milestone: sage-4.1
Component: basic arithmetic | Keywords: Finite field, call
Reviewer: | Author: Simon King
Merged: |
------------------------------+---------------------------------------------
The {{{__call__}}} method of {{{FiniteField_prime_modn}}} reads like this:
{{{
def __call__(self, x):
try:
return integer_mod.IntegerMod(self, x)
except (NotImplementedError, PariError):
return TypeError, "error coercing to finite field"
except TypeError:
if sage.interfaces.all.is_GapElement(x):
from sage.interfaces.gap import gfq_gap_to_sage
try:
return gfq_gap_to_sage(x, self)
except (ValueError, IndexError, TypeError), msg:
raise TypeError, "%s\nerror coercing to finite
field"%msg
else:
raise
}}}
So, in the fourth line of the function body, an error is not raised but
returned.
Actually I met this when calling {{{GF(2)}}} with one of my extension
types. Unfortunately I did not find anything in Sage that would trigger it
as well.
Anyway, I think it should be obvious that
{{{
return TypeError, "error coercing to finite field"
}}}
should be changed into
{{{
raise TypeError, "error coercing to finite field"
}}}
This is what my patch does.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6468>
Sage <http://sagemath.org/>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---