Closed tiagocoutinho closed 6 years ago
After using msgpack_numpy 0.4.2 to patch msgpack, when I pass my custom default/object_hook to msgpack.pack(b)/msgpack.unpack(b) I loose the ability to pack/unpack numpy.
default/object_hook
msgpack.pack(b)/msgpack.unpack(b)
Example:
import pickle import numpy import msgpack import msgpack_numpy msgpack_numpy.patch() def encode_pickle(obj): return dict(__pickle__=1, as_str=pickle.dumps(obj)) data = numpy.arange(10) # this works, obviously: msgpack.packb(data) # this raises TypeError: can't serialize array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) msgpack.packb(data, default=encode_pickle)
This PR proposes to fix that.
Many of the unit tests appear to be broken by your PR. Can you please fix?
Yes, of course. Sorry for that. It should be ok now.
Thanks!
After using msgpack_numpy 0.4.2 to patch msgpack, when I pass my custom
default/object_hook
tomsgpack.pack(b)/msgpack.unpack(b)
I loose the ability to pack/unpack numpy.Example:
This PR proposes to fix that.