Skip to content

RecursionError when comparing two dictionaries referenced to itself #126749

@vodkar

Description

@vodkar

Bug report

Bug description:

Is this expected behavior?

d = {}
d["a"] = d
d2 = {}
d2["a"] = d2
d == d2

Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RecursionError: maximum recursion depth exceeded in comparison

CPython versions tested on:

3.12

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions