Decode masgpack hash key values as byte
This commit is contained in:
parent
c7b4e28f82
commit
6e5bf5fef6
1 changed files with 2 additions and 2 deletions
|
@ -65,7 +65,7 @@ def objectDecoderHook(obj):
|
||||||
for key, val in obj:
|
for key, val in obj:
|
||||||
if type(key) is bytes:
|
if type(key) is bytes:
|
||||||
key = key.decode("utf8")
|
key = key.decode("utf8")
|
||||||
if key in bin_value_keys or type(val) is not bytes:
|
if key in bin_value_keys or type(val) is not bytes or len(key) >= 64:
|
||||||
back[key] = val
|
back[key] = val
|
||||||
else:
|
else:
|
||||||
back[key] = val.decode("utf8")
|
back[key] = val.decode("utf8")
|
||||||
|
@ -100,4 +100,4 @@ def numUnprocessedBytes(unpacker):
|
||||||
num_bytes = unpacker_bytes - unpacker.tell()
|
num_bytes = unpacker_bytes - unpacker.tell()
|
||||||
else:
|
else:
|
||||||
num_bytes = unpacker._fb_buf_n - unpacker._fb_buf_o
|
num_bytes = unpacker._fb_buf_n - unpacker._fb_buf_o
|
||||||
return num_bytes
|
return num_bytes
|
||||||
|
|
Loading…
Reference in a new issue