#10217: bug in rings/fast_arith.pyx
-----------------------------------------------+----------------------------
       Reporter:  was                          |         Owner:  AlexGhitza  
           Type:  defect                       |        Status:  needs_review
       Priority:  minor                        |     Milestone:  sage-5.0    
      Component:  basic arithmetic             |    Resolution:              
       Keywords:                               |   Work issues:              
Report Upstream:  N/A                          |     Reviewers:              
        Authors:  Mike Hansen, Andre Apitzsch  |     Merged in:              
   Dependencies:                               |      Stopgaps:              
-----------------------------------------------+----------------------------

Old description:

> This chunk of code in fast_arith.pyx:
> {{{
>
>     cdef public long long c_inverse_mod_longlong(self, long long a, long
> long m) except -1:
>         cdef long long g, s, t
>         g = self.c_xgcd_longlong(a,m, &s, &t)
>         s = s % m
>         if s < 0:
>             s = s + m
>         return s
> }}}
> should raise an exception if g != 1, so should be
> {{{
>
>     cdef public long long c_inverse_mod_longlong(self, long long a, long
> long m) except -1:
>         cdef long long g, s, t
>         g = self.c_xgcd_longlong(a,m, &s, &t)
>         if g != 1: raise ZeroDivisionError
>         s = s % m
>         if s < 0:
>             s = s + m
>         return s
> }}}

New description:

 This chunk of code in fast_arith.pyx:

 {{{

     cdef public long long c_inverse_mod_longlong(self, long long a, long
 long m) except -1:
         cdef long long g, s, t
         g = self.c_xgcd_longlong(a,m, &s, &t)
         s = s % m
         if s < 0:
             s = s + m
         return s
 }}}
 should raise an exception if g != 1, so should be

 {{{

     cdef public long long c_inverse_mod_longlong(self, long long a, long
 long m) except -1:
         cdef long long g, s, t
         g = self.c_xgcd_longlong(a,m, &s, &t)
         if g != 1: raise ZeroDivisionError
         s = s % m
         if s < 0:
             s = s + m
         return s
 }}}

 '''Apply''' attachment:trac_10217_merged.patch

--

Comment (by aapitzsch):

 I've replaced the deprecated {{{raise}}} syntax by a Python 3 compatible
 one.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10217#comment:5>
Sage <http://www.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.

Reply via email to