From: Laurent S. <re...@bu...> - 2016-01-04 15:36:14
|
New submission from Laurent Senta: I'm trying to use ByteArrays in a dict and I get duplicated keys, It appears that in Jython bytearray can be hashed (not in regular python 2.7) but the hash is not consistent with the equality operator: >>> from array import array >>> xs = [ array('b', [99, 111, 117, 110, 116, 45, 105, 116, 101, 109, 115]), array('b', [99, 111, 117, 110, 116, 45, 105, 116, 101, 109, 115]), array('b', [98, 121, 116, 101, 45, 115, 105, 122, 101]) ] >>> xs[0] == xs[1] True >>> xs[0] == xs[2] False >>> map(hash, xs) [1363822052, 1722768342, 576563150] ---------- messages: 10585 nosy: lsenta severity: normal status: open title: hash and equality of bytearrays are not consistent type: behaviour versions: Jython 2.7 _______________________________________ Jython tracker <re...@bu...> <http://bugs.jython.org/issue2451> _______________________________________ |