#5971: fix dumb error message when modding out by 0: Mod(10,0)
------------------------------+---------------------------------------------
Reporter: was | Owner: somebody
Type: defect | Status: new
Priority: minor | Milestone: sage-4.0
Component: basic arithmetic | Keywords:
------------------------------+---------------------------------------------
When doing Mod(n,0), either there should be a useful error message, or one
should get n back. The following is no good at all -- one shouldn't get
an AttributeError, which is surely due to a bug.
{{{
sage: a = Mod(10,0)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call
last)
115 cdef IntegerMod_abstract x
--> 116 x = IntegerMod(integer_mod_ring.IntegerModRing(m), n)
117 if parent is None:
118 return x
/Users/wstein/build/sage-3.4.2.rc0/local/lib/python2.5/site-
packages/sage/rings/integer_mod.so in sage.rings.integer_mod.IntegerMod
(sage/rings/integer_mod.c:2730)()
132 cdef NativeIntStruct modulus
133 cdef Py_ssize_t res
--> 134 modulus = parent._pyx_order
135 if modulus.table is not None:
136 if PY_TYPE_CHECK(value, sage.rings.integer.Integer) or
PY_TYPE_CHECK(value, int) or PY_TYPE_CHECK(value, long):
AttributeError: 'sage.rings.integer_ring.IntegerRing_class' object has no
attribute '_pyx_order'
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5971>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---