mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-21 04:43:17 +00:00
Merge pull request #165 from frsyuki/fix-string-too-large-message
Fix wrong 'dict is too large' on unicode string
This commit is contained in:
commit
151a16d216
1 changed files with 3 additions and 3 deletions
|
@ -174,11 +174,11 @@ cdef class Packer(object):
|
|||
o = PyUnicode_AsEncodedString(o, self.encoding, self.unicode_errors)
|
||||
L = len(o)
|
||||
if L > (2**32)-1:
|
||||
raise ValueError("dict is too large")
|
||||
raise ValueError("unicode string is too large")
|
||||
rawval = o
|
||||
ret = msgpack_pack_raw(&self.pk, len(o))
|
||||
ret = msgpack_pack_raw(&self.pk, L)
|
||||
if ret == 0:
|
||||
ret = msgpack_pack_raw_body(&self.pk, rawval, len(o))
|
||||
ret = msgpack_pack_raw_body(&self.pk, rawval, L)
|
||||
elif PyDict_CheckExact(o):
|
||||
d = <dict>o
|
||||
L = len(d)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue