From 8c2effad4fe563b90cf2590e1ead84188609c24f Mon Sep 17 00:00:00 2001 From: Aurojit Panda Date: Sat, 17 May 2014 16:59:16 -0700 Subject: [PATCH] Change codec so it does not crashed on func --- erlastic/codec.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erlastic/codec.py b/erlastic/codec.py index 03b8439..22ee8f9 100644 --- a/erlastic/codec.py +++ b/erlastic/codec.py @@ -70,6 +70,12 @@ def decode_h(self, bytes, offset): items.append(val) return tuple(items), offset + def decode_p(self, bytes, offset = 0): + """Decode NEW_FUN_EXT""" + size = struct.unpack(">L", bytes[offset:offset+4])[0] + arity = ord(bytes[4]) + return "f/%d"%(arity), offset+size + def decode_i(self, bytes, offset): """LARGE_TUPLE_EXT""" arity = struct.unpack(">L", bytes[offset:offset+4])[0]