-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Appending a list to a list causes recursion #251
Comments
This also happens on Python 3.11 and box 7. What's weird is that if you debug that line |
Also if you do it like this it works for some reason: a.list_of_dicts.append(BoxList([{"example2": 2}])) |
The issue comes down to reuse of print(id([{"example2": 2}]))
print(id([{"example2": 1}]))
print(id([{"2": 1}]))
print(id([{"5": "2", "2": "4"}]))
Because as soon as the life of one object is over, that from box import Box
a = Box({"list_of_dicts": [[{"example1": 1}]]})
b = [{"example2": 2}]
a.list_of_dicts.append(b)
assert a['list_of_dicts'][1] == [{"example2": 2}], a['list_of_dicts'][1] So what was happening is the object That means the first object could be cleared from memory now that it's in a new space. Object Then Know the cause now. Just need to figure out best approach to go forward. |
* Adding #255 defer ipython import for large import speed improvements (thanks to Eric Prestat) * Adding testing for Python 3.12 * Fixing #253 merge_update box list merge types not populated to sub dictionaries (thanks to lei wang) * Fixing #257 Two test failures due to arguments having incorrect types (thanks to Michał Górny) * Fixing stub files to match latest code signatures * Removing #251 support for circular references in lists (thanks to d00m514y3r) --------- Co-authored-by: Eric Prestat <eric.prestat@gmail.com>
Decided best course of action is to just fully remove support for self references inside of lists, as it is a rare and dangerous use-case anyways (says the guy who doesn't want to figure out how to support it.) Updated in 7.1.0 |
* Adding #266 support for accessing nested items in BoxList using numpy-style tuple indexing (thanks to Bit0r) * Adding tests and Cython releases for Python 3.12 * Fixing #251 support for circular references in lists (thanks to Muspi Merol) * Fixing #261 altering all `__repr__` methods so that subclassing will output the correct class name (thanks to Gabriel Tkacz) * Fixing #267 Fix type 'int' not iterable (thanks to YISH) --------- Co-authored-by: Bit0r <nie_wang@outlook.com> Co-authored-by: Muspi Merol <me@promplate.dev> Co-authored-by: Gabriel Tkacz <55806524+gtkacz@users.noreply.github.com> Co-authored-by: Gabriel Tkacz <gabriel.tkacz@gscap.com.br> Co-authored-by: YISH <mokeyish@hotmail.com>
reproduce:
Using python 3.10.9 and python-box 6.0.2
The text was updated successfully, but these errors were encountered: