id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,merged,author,reviewer,upstream,work_issues,branch,commit,dependencies,stopgaps
28112,py3: Fix hash function of Integer,gh-mwageringel,,"This ticket fixes an issue in `sage.libs.gmp.pylong.mpz_pythonhash`, the hash function for Integer, and resolves the Python 3 doctest failures in `sage/rings/integer.pyx`.
More precisely, the implementation of `mpz_pythonhash` is using the fact that `y <= modulus`, as explained in the comment
{{{
# Safely compute h = (h + y) % modulus knowing that h < modulus
# and y <= modulus
}}}
However, this assumption is not always correct, as `y` is the sum of up to three numbers. For example, this fails in
{{{
sage: hash(2^64 - 1), hash(int(2^64 - 1))
(2305843009213693958, 7)
}}}
",defect,closed,major,sage-8.9,python3,fixed,,,,Markus Wageringel,"Jeroen Demeyer, John Palmieri, Frédéric Chapoton",N/A,,b13f7f812bd02ae02a2a2549c860cc20cbc1bcd6,b13f7f812bd02ae02a2a2549c860cc20cbc1bcd6,,