KowalskiThomas · GitHub

Bug report

Bug description:

As far as I know, the expectation is a == b => hash(a) == hash(b), but currently, the following code fails:

a = frozendict({"a": 1})
b = frozendict({"b": 2})
c = frozendict({"a": 1, "b": 2})
c_union = a | b
assert c == c_union
assert hash(c) == hash(c_union)

with

  File "t.py", line 8, in <module>
    assert hash(c) == hash(c_union)
           ^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

I have a fix ready in #149675.

CPython versions tested on:

3.15

Operating systems tested on:

macOS

Linked PRs

Read the original on github.com ↗