Closed
Description
I have the following test script that packs a custom type and unpacks it again:
import msgpack
_MyClass_Type = 12
class MyClass:
def __init__(self, data):
self.data = data
def _msgpack_encoder(obj):
if isinstance(obj, MyClass):
return msgpack.ExtType(_MyClass_Type, obj.data)
else:
raise TypeError("Unknown type: %r" % (obj,))
def _msgpack_decoder(code, data):
if code == _MyClass_Type:
return MyClass(data)
else:
return msgpack.ExtType(code, data)
o = MyClass(b'test')
packed = msgpack.packb(o, default=_msgpack_encoder, use_bin_type=True)
print('packed:', packed)
unpacked = msgpack.unpackb(packed, ext_hook=_msgpack_decoder, encoding='utf-8')
print('unpacked:', unpacked.data)
It works fine with e.g. Python 3.4 on Windows or Python 3.5 on Linux.
However, the combination of Windows and Python 3.5.2 (in my case 64-bit) raises the following exception:
Traceback (most recent call last):
File "msgpack_test.py", line 28, in <module>
unpacked = msgpack.unpackb(packed, ext_hook=_msgpack_decoder, encoding='utf-8')
File "msgpack\_unpacker.pyx", line 138, in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:138)
MemoryError
This error happens in 0.4.6, 0.4.7 and the current Github-Master, but only when I use Python 3.5.2 on Windows.
Metadata
Metadata
Assignees
Labels
No labels