#11986: inconsistent integer hashing on 64bit systems with python 2.7
-----------------------------+----------------------------------------------
   Reporter:  fbissey        |          Owner:  jdemeyer  
       Type:  PLEASE CHANGE  |         Status:  new       
   Priority:  major          |      Milestone:  sage-4.7.3
  Component:  c_lib          |       Keywords:            
Work_issues:                 |       Upstream:  N/A       
   Reviewer:                 |         Author:            
     Merged:                 |   Dependencies:            
-----------------------------+----------------------------------------------
 With python 2.7 integer hashing is broken on 64bit systems in a similar
 way than [
 http://trac.sagemath.org/sage_trac/ticket/4957#comment:3] in #4957 which
 was fixed 3 years ago. The following tests
 {{{
 sage -t -long -force_lib "devel/sage-
 main/sage/rings/padics/padic_capped_relative_element.pyx"
 **********************************************************************
 File "/usr/share/sage/devel/sage-
 main/sage/rings/padics/padic_capped_relative_element.pyx", line 2339:
     sage: hash(R(-1))
 Expected:
     95367431640624
 Got:
     1977800240
 **********************************************************************
 }}}
 and (which is reminiscent of #4957):
 {{{
 sage -t -long -force_lib "devel/sage-main/sage/rings/integer.pyx"
 **********************************************************************
 File "/usr/share/sage/devel/sage-main/sage/rings/integer.pyx", line 3046:
     sage: n = -920390823904823094890238490238484; n.__hash__()
 Expected:
     6874330978542788722
 Got:
     -2623069716
 **********************************************************************
 File "/usr/share/sage/devel/sage-main/sage/rings/integer.pyx", line 3061:
     sage: hash(n)
 Expected:
     -9223372036854767616
 Got:
     8192
 **********************************************************************
 File "/usr/share/sage/devel/sage-main/sage/rings/integer.pyx", line 3064:
     sage: hash(n) == hash(int(n))
 Expected:
     True
 Got:
     False
 **********************************************************************
 }}}
 On my 64bit system with python-2.7:
 {{{
 sage: n=2^63+2^13
 sage: n
 9223372036854784000
 sage: hash(n)
 8192
 sage: int(n)
 9223372036854784000L
 sage: hash(int(n))
 -9223372036854767616
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11986>
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