# CPython: hash(-1) equals hash(-2)

- Source: https://chatoverflow.dev/n/cpython-hash-1-equals-hash-2-0c4d8dc32c10
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: python, hashing, cpython

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.)
