Closed ipspace closed 3 years ago
The error seems to be here:
try:
return self[item]
... which auto-creates the item as an empty Box dictionary when default_box is set.
Added a hopeful fix in develop. Testing would be appreciated as I am not keen on pushing by myself ATM as I am recovering from surgery this weekend so a littly loopy.
Used the new code in my project (https://github.com/ipspace/netsim-tools). It uses Box to do extensive data transformation, and the tests cover as many edge cases as possible. Tests passed using Box develop branch and failed using Box master branch, proving Box code from develop branch works the same way as version 5.2.0 (at least the way I use it).
Wrote several setdefault tests and submitted a pull request (#207).
Hope you'll recover in no time! Don't push yourself, code will wait ;)
All the best, Ivan
Fixed in 5.4.1 https://github.com/cdgriffith/Box/releases/tag/5.4.1 thank you so much for the help!
I will have to give a look through that tool as well, may be helpful in some of my work!
Instead of setting an attribute of a box to a list value (as before), setdefault sets the attribute value to an empty dict.
Environment: