Update() is broken as of 3.4.3
See original GitHub issueGiven this sample code:
import box
if __name__ == '__main__':
b = box.Box({
'one': {
'sub1': 'monkey',
'sub2': 'goat',
}
}, box_it_up = True)
print(f'box: {b}')
print(f'one is a {type(b.one)}')
print(f'expect monkey: {b.one.sub1}')
print(f'expect goat: {b.one.sub2}')
b.update({'one': {'sub2': 'alpaca'}})
print(f'one is a {type(b.one)}')
print(f'expect monkey: {b.one.sub1}')
print(f'expect alpaca: {b.one.sub2}')
It works with < 3.4.3:
box: {'one': {'sub1': 'monkey', 'sub2': 'goat'}}
one is a <class 'box.Box'>
expect monkey: monkey
expect goat: goat
one is a <class 'box.Box'>
expect monkey: monkey
expect alpaca: alpaca
But using >= 3.4.3, this is the result:
box: {'one': {'sub1': 'monkey', 'sub2': 'goat'}}
one is a <class 'box.Box'>
expect monkey: monkey
expect goat: goat
one is a <class 'dict'>
Traceback (most recent call last):
File "./test.py", line 16, in <module>
print(f'expect monkey: {b.one.sub1}')
AttributeError: 'dict' object has no attribute 'sub1'
I notice there were changes to the update()
method.
(edited: added some code to print out the types, which show the difference)
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Resolved - Plesk CentOS 7.8 ImageMagick Update Error
I ran the updates with yum clean all && yum -y update --skip-broken now its waiting for plesk to recompile the php-imagick rpm's...
Read more >Compatibility with gulp-sass 4.1.1 broken with bootstrap-sass ...
1", will update to 3.4.3 and break every project. If the change is released under 3.5 or 4.0 , then it wouldn't be...
Read more >Yum update fails due to dependency resolution
Hi, I am trying to update packages in RedHat 7.6 and I keep getting this error due to dependency resolution. I have tried...
Read more >Link to Comments archive on bottom of page broken as of 3.4.3
I have tried with all plugins disabled. Still broken. It is definitely a bug in Atahualpa 3.4.3+ as it is still working if...
Read more >[SOLVED] Frontend editing broken after migrating to 3.4.3 - Page 3 ...
Hello, After migrating Joomla from 2.5.8 to 3.4.3, frontend editing is broken; Save does not react, only loading start page in the... -...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hooray:
Looks great! Thanks for the quick work on this, and for the excellent library!
Thanks! It actually took me about an hour to dig in enough to find the cause - we subclass Box with a bunch of extra logic, so there were a lot of places it could have been.