Serializable ununpickleable
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Charm Helpers |
Fix Released
|
Undecided
|
Stuart Bishop |
Bug Description
Serializable instances can be pickled, but cannot be unpickled.
>>> from charmhelpers.
>>> import pickle
>>> s = Serializable({})
>>> pickle.dumps(s)
"(icharmhelpers
>>> pickle.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/
return Unpickler(
File "/usr/lib/
dispatch[
File "/usr/lib/
setstate = getattr(inst, "__setstate__", None)
File "charmhelpers/
got = getattr(self.data, attr, MARKER)
File "charmhelpers/
return self.__dict__[attr]
KeyError: 'data'
>>>
Related branches
- Adam Gandelman (community): Approve
-
Diff: 114 lines (+51/-4)2 files modifiedcharmhelpers/core/hookenv.py (+18/-4)
tests/core/test_hookenv.py (+33/-0)
Changed in charm-helpers: | |
assignee: | nobody → Stuart Bishop (stub) |
status: | New → Fix Released |
Workaround is to manually unwrap objects return from hookenv tools, as it implicitly wraps stuff with the magic helper.