We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
In python 3, FrozenDict can be pickled, but not unpickled (python2 does not have this issue):
FrozenDict
$ python3 -c 'from vdom.frozendict import FrozenDict; from six.moves import cPickle; cPickle.loads(cPickle.dumps(FrozenDict(a=1), -1))' Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/local/python/python-3.7/std/lib64/python3.7/site-packages/vdom/frozendict.py", line 26, in __setitem__ return self.__readonly__(super(FrozenDict, self).__setitem__, *args, **kwargs) File "/usr/local/python/python-3.7/std/lib64/python3.7/site-packages/vdom/frozendict.py", line 21, in __readonly__ raise ValueError("Can not modify FrozenDict") ValueError: Can not modify FrozenDict
I believe this is due to the reduce method. For example, this fixes it:
from vdom.frozendict import FrozenDict def _reduce_vdom_frozendict(self): return (FrozenDict, (tuple(self.items()),)) FrozenDict.__reduce__ = _reduce_vdom_frozendict
I am happy to make a PR if you believe this is the right fix.
The text was updated successfully, but these errors were encountered:
Bumping this as we still run into it sometimes. Would you be willing to accept a PR for this?
CC @captainsafia @rgbkrk @willingc
Sorry, something went wrong.
No branches or pull requests
Hi,
In python 3,
FrozenDict
can be pickled, but not unpickled (python2 does not have this issue):I believe this is due to the reduce method. For example, this fixes it:
I am happy to make a PR if you believe this is the right fix.
The text was updated successfully, but these errors were encountered: