Skip to content

Issues with Self-Referential Benedicts #592

Description

@knightofkessler

Python version
3.10.13

Package version
0.38.0

Current behavior (bug description)
The Benedict API would be extremely useful for storing and manipulating deeply nested, self-referential data-structures. However, self-referential benedicts sometimes work and sometimes don't.

This works:

from benedict import benedict
test = benedict(keyattr_enabled=True, keyattr_dynamic=True)
test.a.b.c = test

This does not:

from benedict import benedict
test = benedict(keyattr_enabled=True, keyattr_dynamic=True)
test.a.b.c = test
test.a.b.d.e = test

In Jupyter, the latter often leads to kernel crashes or RecursionErrors. It seems that __setitem__ is getting stuck in an infinite loop in traverse.py.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

Status
Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions