8000 Merge pull request #165 from frsyuki/fix-string-too-large-message · xiaomauncle/msgpack-python@151a16d · GitHub
[go: up one dir, main page]

Skip to content

Commit 151a16d

Browse files
committed
Merge pull request msgpack#165 from frsyuki/fix-string-too-large-message
Fix wrong 'dict is too large' on unicode string
2 parents 68d62bf + 83424bd commit 151a16d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

msgpack/_packer.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ cdef class Packer(object):
174174
o = PyUnicode_AsEncodedString(o, self.encoding, self.unicode_errors)
175175
L = len(o)
176176
if L > (2**32)-1:
177-
raise ValueError("dict is too large")
177+
raise ValueError("unicode string is too large")
178178
rawval = o
179-
ret = msgpack_pack_raw(&self.pk, len(o))
179+
ret = msgpack_pack_raw(&self.pk, L)
180180
if ret == 0:
181-
ret = msgpack_pack_raw_body(&self.pk, rawval, len(o))
181+
ret = msgpack_pack_raw_body(&self.pk, rawval, L)
182182
elif PyDict_CheckExact(o):
183183
d = <dict>o
184184
L = len(d)

0 commit comments

Comments
 (0)
0