Message406917
Hello. I would like to point out a possible problem that this change to CPython has introduced.
This change looks innocent, but it breaks the unwritten rule that the hash value of a number (or actually any built-in immutable type!) in Python depends only on its value.
Thus, before this change, it was possible to convert a tuple of floats into a numpy array and back into a tuple, and the hash values of both tuples would be equal. This is no longer the case.
Or, more generally, any hashable tuple could be pickled and unpickled, without changing its hash value. I could well imagine that this breaks real code in subtle ways.
Likewise, it is now no longer possible to provide a library of sequences of numbers that always hashes like built-in tuples. (As "tinyarray", of which I am the author, did.) |
|
Date |
User |
Action |
Args |
2021-11-24 10:38:54 | cwg | set | recipients:
+ cwg, tim.peters, rhettinger, mark.dickinson, serhiy.storchaka, miss-islington, realead, congma |
2021-11-24 10:38:53 | cwg | set | messageid: <1637750333.97.0.574727367034.issue43475@roundup.psfhosted.org> |
2021-11-24 10:38:53 | cwg | link | issue43475 messages |
2021-11-24 10:38:53 | cwg | create | |
|