[3.10] bpo-44636: Collapse union of equal types (GH-27178) (GH-27181)

The result of `int | int` is now `int`.

Fix comparison of the union type with non-hashable objects.
`int | str == {}` no longer raises a TypeError.
(cherry picked from commit d9f923280f204204f8703756aef4f655b579b4b8)
3 files changed