#14388: Fix Cygwin failure in plural polynomials overflow error
-----------------------------------+----------------------------------------
       Reporter:  kcrisman         |         Owner:  tbd     
           Type:  defect           |        Status:  new     
       Priority:  major            |     Milestone:  sage-5.9
      Component:  porting: Cygwin  |    Resolution:          
       Keywords:  Cygwin           |   Work issues:          
Report Upstream:  N/A              |     Reviewers:          
        Authors:                   |     Merged in:          
   Dependencies:                   |      Stopgaps:          
-----------------------------------+----------------------------------------

Comment (by nbruin):

 Replying to [comment:3 kcrisman]:
 > So you think it could be basically the same type of problem as #14254?
 Unfortunately this particular set of errors wasn't fixed by that ticket.

 It looks like it's exactly that problem. Look at line 573 of plural.pyx
 {{{
     def __hash__(self):
 ...
         return id(self)
 }}}
 The special method `__hash__` is supposed to return a `Py_hash_t`
 (probably a "long"). The code is trying to return `id`, which is a python
 integer, and on a machine where ints are 32 bits, can easily exceed
 `2^31`. So it won't be able to convert to an int. Explicitly cast instead,
 via something like
 {{{
     return <Py_hash_t><void*>self
 }}}
 which will be orders of magnitude faster too.

 Incidentally, Python itself shifts right by 2 any time an id gets used as
 a hash, because the lowest two bits are almost certainly 0.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14388#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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to