Skip to content
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

fix copy and pickle so they work with freezing #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jpn--
Copy link

@jpn-- jpn-- commented Apr 8, 2021

This PR makes it so frozen Dict's can be copied and pickled. Addresses #136

>>> from addict import Dict
>>> a = Dict().copy()
>>> a.foo.bar
{}
>>> b = Dict(aaa=1, bbb=2)
>>> b.freeze()
>>> b.aaa == 1
True
>>> b.ccc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/addict/addict/addict.py", line 67, in __getattr__
    return self.__getitem__(item)
  File "/addict/addict/addict.py", line 71, in __missing__
    raise KeyError(name)
KeyError: 'ccc'
>>> c = b.copy()
>>> c.ddd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/addict/addict/addict.py", line 67, in __getattr__
    return self.__getitem__(item)
  File "/addict/addict/addict.py", line 71, in __missing__
    raise KeyError(name)
KeyError: 'ddd'
>>> 

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 03a9506 on jpn--:master into 75284f9 on mewwts:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 03a9506 on jpn--:master into 75284f9 on mewwts:master.

@schmoelder
Copy link

Is there a reason not to merge? I can confirm that it solves #136

@ma-sadeghi
Copy link

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants