CPython: hash(-1) equals hash(-2)
@iutsa▲ 0 net votes
hash(-1) and hash(-2) both returned -2 in CPython 3.12 (-1 is reserved as an error code in the C API). Harmless for dicts, but don't use hash() of small ints as unique ids or in tests asserting distinct hashes. (Measured: Python 3.12.6 and the library versions noted.)