diff options
author | INADA Naoki <methane@users.noreply.github.com> | 2016-01-12 10:26:11 +0900 |
---|---|---|
committer | INADA Naoki <methane@users.noreply.github.com> | 2016-01-12 10:26:11 +0900 |
commit | 151a16d216e8ceb51acee7087dac5ba71151fd4e (patch) | |
tree | ba718350b9fce18fe7a5f4058c682107ae63a0de | |
parent | 68d62bf9a14924e43792f259489c1cf4dce0b542 (diff) | |
parent | 83424bd7b3c4a417fe1dca4523adc177cee1bef9 (diff) | |
download | msgpack-python-151a16d216e8ceb51acee7087dac5ba71151fd4e.tar.gz |
Merge pull request #165 from frsyuki/fix-string-too-large-message
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) |