summaryrefslogtreecommitdiff
path: root/msgpack/_packer.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'msgpack/_packer.pyx')
-rw-r--r--msgpack/_packer.pyx6
1 files changed, 6 insertions, 0 deletions
diff --git a/msgpack/_packer.pyx b/msgpack/_packer.pyx
index 985559c..f2a0f76 100644
--- a/msgpack/_packer.pyx
+++ b/msgpack/_packer.pyx
@@ -176,6 +176,9 @@ cdef class Packer(object):
for v in o:
ret = self._pack(v, nest_limit-1)
if ret != 0: break
+ elif self.handle_unknown_type(o):
+ # it means that obj was succesfully packed, so we are done
+ return 0
elif self._default:
o = self._default(o)
ret = self._pack(o, nest_limit-1)
@@ -195,6 +198,9 @@ cdef class Packer(object):
self.pk.length = 0
return buf
+ def handle_unknown_type(self, obj):
+ return None
+
def pack_extended_type(self, typecode, data):
msgpack_pack_ext(&self.pk, typecode, len(data))
msgpack_pack_raw_body(&self.pk, data, len(data))