diff options
author | Sadayuki Furuhashi <frsyuki@gmail.com> | 2016-01-11 13:57:33 -0800 |
---|---|---|
committer | Sadayuki Furuhashi <frsyuki@gmail.com> | 2016-01-11 13:57:33 -0800 |
commit | 83424bd7b3c4a417fe1dca4523adc177cee1bef9 (patch) | |
tree | ba718350b9fce18fe7a5f4058c682107ae63a0de | |
parent | 68d62bf9a14924e43792f259489c1cf4dce0b542 (diff) | |
download | msgpack-python-83424bd7b3c4a417fe1dca4523adc177cee1bef9.tar.gz |
Fix wrong 'dict is too large' on unicode string
-rw-r--r-- | msgpack/_packer.pyx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/msgpack/_packer.pyx b/msgpack/_packer.pyx index 0a6513c..6392655 100644 --- a/msgpack/_packer.pyx +++ b/msgpack/_packer.pyx @@ -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) |